Top "Collections" questions

Collections APIs provide developers with a set of classes and interfaces that make it easier to handle collections of objects.

How to convert int[] into List<Integer> in Java?

How do I convert int[] into List<Integer> in Java? Of course, I'm interested in any other answer …

java arrays collections boxing autoboxing
Printing HashMap In Java

I have a HashMap: private HashMap<TypeKey, TypeValue> example = new HashMap<TypeKey, TypeValue>(); Now I would …

java collections
How can I sort a List alphabetically?

I have a List<String> object that contains country names. How can I sort this list alphabetically?

java list sorting collections alphabetical
How to clone ArrayList and also clone its contents?

How can I clone an ArrayList and also clone its items in Java? For example I have: ArrayList<Dog&…

java collections clone deep-copy
Simple way to find if two different lists contain exactly the same elements?

What is the simplest way to find if two Lists contain exactly the same elements, in the standard Java libraries? …

java collections
C# Set collection?

Does anyone know if there is a good equivalent to Java's Set collection in C#? I know that you can …

c# .net collections set
Java: Get first item from a collection

If I have a collection, such as Collection<String> strs, how can I get the first item out? …

java collections iterable
Java - How to create new Entry (key, value)

I'd like to create new item that similarly to Util.Map.Entry that will contain the structure key, value. The …

java dictionary collections key-value
Removing items from a list

While looping through a list, I would like to remove an item of a list depending on a condition. See …

java collections
Retrieving a List from a java.util.stream.Stream in Java 8

I was playing around with Java 8 lambdas to easily filter collections. But I did not find a concise way to …

collections lambda java-8 java-stream