how to create immutable map in java?

The java.util.Collections class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, “wrappers”, which return a new collection backed by a specified collection, and a few other odds and ends. Collections.unmodifiableMap() method is used to create immutable set in java. It will throws an exception … Read more

how to create immutable set in java?

The java.util.Collections class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, “wrappers”, which return a new collection backed by a specified collection, and a few other odds and ends. Collections.unmodifiableSet() method is used to create immutable set in java. It will throws an exception … Read more

how to create immutable list in java?

The java.util.Collections class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, “wrappers”, which return a new collection backed by a specified collection, and a few other odds and ends. Collections.unmodifiableList() method is used to create immutable list in java. It will throws an exception … Read more

How to create synchronized map?

The java.util.Collections class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, “wrappers”, which return a new collection backed by a specified collection, and a few other odds and ends. Collections.synchronizedMap() method will returns a synchronized (thread-safe) map backed by the specified map. In order … Read more

How to create synchronized set?

The java.util.Collections class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, “wrappers”, which return a new collection backed by a specified collection, and a few other odds and ends. Collections.synchronizedSet() method will returns a synchronized (thread-safe) set backed by the specified set. In order … Read more

how to create synchronized list in java?

The java.util.Collections class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, “wrappers”, which return a new collection backed by a specified collection, and a few other odds and ends. Collections.synchronizedList() method will returns a synchronized (thread-safe) list backed by the specified list. In order … Read more

how to rotate element in list java?

The java.util.Collections class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, “wrappers”, which return a new collection backed by a specified collection, and a few other odds and ends. Collections.rotate() method will rotates the elements in the specified list by the specified distance. Syntax: … Read more

How to replace all occurrences of a given object in the list?

The java.util.Collections class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, “wrappers”, which return a new collection backed by a specified collection, and a few other odds and ends. Collections.replaceAll() method will replaces all occurrences of one specified value in a list with another. … Read more

How to create multiple copies of a given object?

The java.util.Collections class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, “wrappers”, which return a new collection backed by a specified collection, and a few other odds and ends. Collections.nCopies() method will returns an immutable list consisting of n copies of the specified object. … Read more

How to get min element of a list of user defined objects using Comparator?

The java.util.Collections class consists exclusively of static methods that operate on or return collections. It contains polymorphic algorithms that operate on collections, “wrappers”, which return a new collection backed by a specified collection, and a few other odds and ends. Example   Output   Java Collections class examples Java Collections class How to add all … Read more