1. Introduction This is third article in Java Generics. In previous articles I discussed about Introduction to Java Generics and cast guarantee provided in Generics. […]
How to create Immutable Objects with Example
Immutable objects are those objects that cannot be modified once created. Please read the first article in Immutable Objects series to understand what advantages are […]
Learn about 6 advantages of Immutable Objects.
Let me start this article by quoting Brain Goetz. Immutable objects are simple. They can only be in one state, which is carefully controlled by […]
3 static factory families of Collections class
1. Introduction java.util.Collections class is static utility class which contains polymorphic algorithms, static factories and wrapper methods. It also contains several other interesting methods. All […]
Generics Cast Guarantee
1. Introduction In previous article I wrote about Introduction to Java Generics. In this article we will see what cast guarantee is. Cast guarantee mean […]
Introduction to Java Generics
1. Introduction Generic programming means a code is written in terms of type which can be specified later and those types can be used as […]
Don’t put code block in Optional
1. Introduction In previous few articles we have seen how not to use Optional and explored few areas by refactoring code in better way rather […]
How to Sort HashMap according to keys
This article is going to very interesting as we will explore several different ways on how to sort a HashMap using keys. 1. Introduction Usually […]
How to get all numbers greater than x
1. Introduction Get all numbers greater than x where x is some number. For example, get all the numbers greater than 10. 2. Content We […]
Stream Interface’s methods one-liner description
1. filter(Predicate) Returns a stream consisting of elements of this stream which matches the given Predicate. 2. map(Function) Returns a stream consisting of elements that […]
How to use BufferedReader class Java 8 method lines()
1. Overview BufferedReader is a class that is used to read text from character input stream which provides efficient reading of characters, arrays and lines. […]
Iterable Interface Enhancements : What’s new in Java 8.
1. Overview Iterable interface provides a contract which is, if implemented the object will be allowed as a target of for-each loop. Collection interface extends […]