Tag: Generics

Convert HashMap to TreeMap in Java

In this post, we will see how to convert HashMap to TreeMap in Java. The resultant TreeMap should contain all mappings of the HashMap, sorted by their natural ordering of keys.

Concatenate Multiple Lists in Java

In this article, several methods to concatenate multiple lists in Java into a single list are discussed using plain Java, Java 8, Guava Library and Apache Commons Collections.

Convert a Set to Stream in Java 8

In this post, we will see how to convert a set to stream in Java 8. We will also learn how to apply filters on a stream and convert stream back to a set or list.