Top K Frequent Items

javascalaproblem

This post explores a functional style implementation in Scala and Java to a famous interview question to find the top k frequent items in an array. Beware the functional implementation may not be …

Read more →

TimedBufferedReader in Java

javabuffered-reader

In the previous post - Why Functional Programming Matters, we explored the design of a high-throughput timed buffered reader in Scala using cats-effect. In this post, we implement the same in Java and …

Read more →

Optional Parameters

javaoptionalscala

The billion dollar mistake has been committed already. No going back. But it is not necessary to keep repeating it. Oh, I am talking about the infamous null. Would Java’s Optional come to the …

Read more →

Iterators vs. Generators

C#designJavajinqLINQprogramming

Yes, there is a difference. Although both produce the same end effect, an iterator is not the same as a generator. The difference is in the way it is implemented and also consumed.

Read more →

Mundane vs JINQ Way

designJavajinqLINQ

New things are not always instantly accepted. Beyond skepticism, new things challenge the comfort people are accustomed to. JINQ wasn’t particularly welcomed. It was either discarded as unknown …

Read more →

JINQ

.NETC#JavajinqLINQprogramming

JINQ (Java INtegrated Query) is an ultra minimalistic library inspired from and mimicking the .NET LINQ. While LINQ is a language level construct, JINQ is composed of types - classes and methods, but …

Read more →

Partial Classes – Java ???

C#Javapartialpartial-class

I am really sorry if I tricked you into believing that Java is offering partial class feature. Unfortunately, Java doesn’t. Maybe never will. But I am going to talk about a workaround also presenting …

Read more →

final, const and beyond

C#constfinalimmutabilityJava

What are your thoughts on the following piece of code? public String someGibberishMethod() { int length = someMethodReturningLength(); int sum = 0; for (int index = 0; index < length; ++index) { // …

Read more →

An Unfair World of Tuples, Anons., var and auto

anonymous-classanonymous-typesautoC#Javatuplesvar

It all began when I wanted to return more than one value from one of the methods. Although my attempts ended futile, it was fun exploring and musing how things could have been. There are at least a …

Read more →

Quiz: Choosing an array of integers !!!

arrayintegersJavareference-typesvalue-types

In the recent interviews, I asked the candidates the following question: Is there a difference that I need to consider in the following declarations? Both allocate fixed size array to store integers: …

Read more →