Category: Java

How to Shuffle or Randomize a List in Java

In this post, we will discuss how to shuffle or randomize a List in Java using Fisher–Yates shuffle algorithm and shuffle() method provided by the Collections class.

Flatten Stream of Arrays or Lists in Java using Stream.concat() method

Java 8 Streams can holds different types of data. For example, Stream<T>, Stream<T[]>, Stream<List<T>> – all these are valid streams in Java 8. We have seen in the previous post that flatMap() method can be used for flattening Streams in Java. In this post, we will flatten Stream of Arrays or Lists using Stream.concat() method …

Guava’s ImmutableSet Class in Java

In this post, we will talk about Guava’s ImmutableSet class in Java which has many static utility methods for creating Immutable Sets in Java.

Guava’s ImmutableList Class in Java

In this post, we will talk about Guava’s ImmutableList class in Java which provides several static utility methods for creating Immutable Lists in Java and to operate on them.

Guava’s Ints Class in Java for primitive int array

Guava com.google.common.primitives package provides utility classes for all primitives types such as Ints, Longs, Chars, Doubles, etc. In this article, we will talk about Guava Ints class which provides static utility methods to work with primitive int, which are not present in Java’s Integer or Arrays class.

Guava’s Lists Class in Java

In this article, we will talk about Guava Lists class which provides several static utility methods pertaining to List instances.