A Bit about Stream Stream is a new feature added in java 8 and represents a sequence of elements. A stream originates from a collection which holds these elements. This collection may be an array, a list, a set, a map etc. It should be remembered that a stream itself does not hold any elements.Read More →

Suppose you want to divide a number a by another number b in java, you will use a / b. So simple, isn’t it. But what if you are required to determine the result by using only minus(-) operator, that is, without using division (/) operator.Read More →

Iterating in reverse order means fetching last element of the map first, second last element at second position and so on. Simple logic is to start a loop from last position of the map till its beginning and fetch element at that position but unfortunatelyjava.util.Map interface or any of its implementations does not have a method to retrieve elements based on index hence you cannot fetch an element based on its position. So how can we reverse iterate a map. Read on !!!Read More →

Sorting values means arranging them in a particular order. The order may be ascending or descending. When the term sorting refers to a Map, it may be sorted on the basis of its keys or values. It depends completely on the requirement. Java 8 provides a convenient method to sort a map. Using this method will cut down the lines of code used by traditional methods of using java.util.TreeMapor java.util.Comparator to some extent.Read More →

Microsoft excel is the most widely used program to maintain data. Hence it becomes vital that the data from an excel sheet be read directly to a java program so that it may be used further to dump into a database or written to an XML file. Java itself does not provide any features to perform excel related operations but there are external libraries written in java which support this. Two of the common libraries are Apache POI and jexcel (or jxl). Both of them provide convenient methods to handle excel files. This post will be using jexcel (or jxl) api for its demonstration.Read More →