Category Archives for Streams

Power of two check, Stream gotcha

October 1, 2017

Recently I came across a rather simple and innocent looking question which highlighted an issue you might run into when using Streams. The question was: how could you decide if a number is a power of two? If you are interested only in the possible issue, jump to the gotcha. Possible solutions Division by two […]

Optimizing Streams: Autoboxing

September 18, 2017

What is Autoboxing and why should I care? Java 8 Streams are powerful tools, but as with any tools, you have to use them properly. To use any tool in a professional way, you have to understand how that tool works. In Java variables can be grouped into two big categories: primitives and objects.For example:┬áint […]