
Collect a Java Stream to an Immutable Collection
1. Introduction We often wish to convert a Java Stream into a collection. This usually results in a mutable collection, but we can customize it. In this […]
1. Introduction We often wish to convert a Java Stream into a collection. This usually results in a mutable collection, but we can customize it. In this […]
1. Overview It is sometimes preferable to disallow modifications to the java.util.Map such as sharing read-only data across threads. For this purpose, we can use either an […]
1. Overview This quick tutorial will show how to make an ArrayList immutable with the core JDK, with Guava and finally with Apache Commons Collections 4. This article is […]
1. Introduction In Java, Strings are immutable. An obvious question that is quite prevalent in interviews is “Why Strings are designed as immutable in Java?” […]
1. Overview In this tutorial, we’ll learn what makes an object immutable, how to achieve immutability in Java, and what advantages come with doing so. […]