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 […]
How to Add(Summation) all elements of an array
1. Overview In this article, we will see how to add all the elements of an array. For example we will use int[] array. Embed […]
Search for a value in an array
1. Overview In this article, we will see how to search for a value in an array. For example we will use int[] array. Embed […]
Java Collections Core Interfaces
Diagram built in BlueJ The core collection interfaces encapsulate different collections such as List, Set, Queue and Deque. Collections operate on generics. Collection Interface declaration […]
Search for a value in Object[] array
1. Overview In this article, we will see how to search for an object in an Object[] array. For example we will use String[] array. […]
Convert Iterator to Collection
1. Overview In this article I will write about converting an Iterator to Collection. Let us begin. Embed from Getty Images 2. Content Below are […]
Testing Optional Return Type
1. Introduction In this article I will discuss how to assert an Optional. I have written a series of articles on Optional, which includes introduction, […]
Bridge between Array and Collection APIs
1. Overview Generally speaking, container is an object such as box which can be used to hold something. In programming container means the same thing. […]
Java Collections and its benefits
Collections aka containers are used to group objects into single entity. Once the objects are stored in a collection you can then perform operations on […]
How to use Boolean class Java 8 methods in Stream API
1. Introduction In this article, we will be go through the new methods added in Boolean class under package java.lang. Boolean class wraps up the […]
Convert array to List
1. Introduction In this article we will see how to convert an array i.e. primitive and object array to List. The following methods acts as […]
Reverse an array using 5 different ways
1. Introduction In this article we will see how to reverse the elements in a primitive array as well as in object array. We will […]
Convert List to array
1. Introduction In this post we will see how to convert List<E> to array in 4 different ways. The following methods acts as a bridge […]
What is Fail-Fast Iterator?
Fail-Fast iterators throw ConcurrentModificationException if the Collection is modified structurally. Fail-Fast iterators fail quickly and cleanly rather than risking the arbitrary non-deterministic behavior at undetermined […]
What is ConcurrentModificationException and why is it useful
ConcurrentModificationException is thrown by methods when they discover concurrent modification of object which such modifications are not permitted. So if the collection is modified structurally […]
Guide to Ints class of Google Guava
1. Overview Ints class in Google Guava provides several static utilities not available in Arrays or Integer class. As primitive types cannot be used as […]
6 different ways to Traverse/Iterate List in Java
1. Introduction In this article, we will see how to traverse the List in a few different ways. This includes traversing using Iterator and without […]