Immutable Collections in Google Guava

Google Guava provides ways to create Immutable Collections. In this post, we will learn to create immutable collections using Google Guava.

January 11, 2021

Enummap in Java

An EnumMap in Java is a specialized map implementation for use with enum type as the keys. In this post, we will learn EnumMaps in Java.

December 29, 2020

Six Ways to Convert a Java Stream to a List

In this post, we will see six ways to convert a Java stream to a List. You can extend these if you want to convert a stream to a Set as well.

December 14, 2020

Java 8 LongStream – A Complete Guide

The Java 8 LongStream is a sequence of primitive long-valued elements and is a long primitive specialization of Stream.

December 8, 2020

Collectors Joining in Java 8

Collectors.joining returns a Collector which concatenates the stream elements separated by a delimiter, prefix and suffix in encounter order.

November 30, 2020

Java 8 StringJoiner With Examples

Java 8 StringJoiner class can be used to build a sequence of characters that are separated by a configured delimiter, prefix and a suffix.

November 23, 2020

4 Ways to throw Checked Exceptions in Java Streams

This post shows 4 ways to throw checked exceptions in Java streams i.e., having a lambda expression that can throw checked exception(s).

November 17, 2020

Java Stream Distinct by Property

Java Streams has a distinct method which removes duplicates by object’s equal method. This post explains ways to apply distinct by a property.

November 9, 2020

Java Stream Distinct with Examples

The Java Stream Distinct is a stateful intermediate operation which returns a new stream which has only the distinct elements in it.

November 2, 2020

Java 8 Stream – FindFirst and FindAny

The Java 8 Streams has findFirst and findAny methods which will return the first element and an arbitrary element from a stream respectively.

October 26, 2020