Convenience Factory Methods for Collections
Java 9 introduced the Convenience Factory Methods for Collections that make it convenient to create instances of collections or maps with few elements
Java 9 introduced the Convenience Factory Methods for Collections that make it convenient to create instances of collections or maps with few elements
A ListIterator in Java is an Iterator that allows us to traverse the list in either direction, modify the list during iteration, and obtain the iterator’s current position in the list.
Introduction In the last post, I wrote about the Gang of Four (GoF) Builder Design Pattern. In this post, we will look at the builder pattern from the Effective Java…
Java has two ways to iterate over the elements of a collection - using an Enumeration and an Iterator. This post explains Enumeration and Iterators in Java.
Optional was added to Java 8. This post explains the new methods or APIs added to the Optional class in Java from Java 9 through 11 with examples.
Optional is a container object added to Java 8+ that is used as a wrapper over some value. It provides a mechanism to represent “no result” for a method.
In this blog post, we will see three ways to sort a list in Java. We will see how to sort in ascending and in reversed order.
A TreeMap is a Red-Black Tree based implementation of a NavigableMap. In this post, we will look at TreeMap in Java and the methods offered by them.
A Map data structure is an object that maps keys to values. We will see how a HashMap works in java. We will also see how get and put operations work.
An immutable class is a class whose instances cannot be modified after it is created. In this post, we will look at the benefits of immutable class in Java.