Parallel Streams!!

I am always skeptical of using parallel streams in Java8. For simple reason: You do not have control to decide the pool responsible for executing tasks. By default, common ForkJoinPool executes it. So in short when you do: The common pool executes it. And you…

Constraint Argument to Multiple Types

A lot of times while writing quick scripts (where I haven’t thought through well), I wish the compiler would be a bit lenient to allow any argument of different types. Like this: Duck typing looks well. But its too lenient for me. I dont like…

Hack Puzzle – 1

I have been thinking for quite some-time to build a puzzle. I think I have built an awesome one and hope everyone finds it awesome to hack You can download the jar from here. Aim: Make the program terminate gracefully Terminate gracegully: Implies that the program should…

Replace View Bounds

Well the scala community has decided to deprecate view bounds in Scala. I suspect it might have to do with brevity. Full discussion can be viewed here Well looks like most of the view bounds (<%) can be converted to context bounds. Lets see different strategies that…

Asynchronous Distributed Key-Value DB

I have developed a simple-beta version of an synchronous distributed key-value database. It is simple and quite robust and I plan to make it not so-simple and open to other languages (apart from JVM based ones) in the future :). You can download it and start…

Atomicity from single-cycle compare & swap

There is a wonderful function defined in scala.concurrent.Future trait called onComplete. Here is the declaration: There is one key-point in the documentation which says : If the future has already been completed, this will either be applied immediately or be scheduled asynchronously. The reason I call…

Issues with Java 7 on Mac OS

At my work place, I was involved in building a desktop application for Mac (priority) & Windows (lesser priority). So for about 5 months, I did all my development work on Mac and now I think I have a good feel of the OS. So…

Continuation….

This post is in continuation to the previous post – Co-variance and Contra-variance Arrays in Java are Co-variant. Which basically means if “String” extends “Object” then “String[]” also extends “Object[]”. Do you see  any pitfall’s above?? Lets look at the following example Example – 1…

Co-variance & Contra-variance

I have been working on Scala recently and it has been a pure pleasure. I am in love with the language. And Yes! it indeed is a beast. Generics/Parametrization is something that has always kept me on the hook even after good amount of experience…

Cache

This is  the first part of series of posts I plan to put-up on effective memory-centric cache implementations. Well I have been working and going through different cache implementations in Java. Below is a discussion on some of them. The aim is to choose the…