Top "Collections" questions

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

Sorted collection in Java

I'm a beginner in Java. Please suggest which collection(s) can/should be used for maintaining a sorted list in …

java sorting collections
What is the best way to clone/deep copy a .NET generic Dictionary<string, T>?

I've got a generic dictionary Dictionary<string, T> that I would like to essentially make a Clone() of ..…

c# generics collections clone
.NET HashTable Vs Dictionary - Can the Dictionary be as fast?

I am trying to figure out when and why to use a Dictionary or a HashTable. I have done a …

c# .net collections dictionary hashtable
How to convert int[] to Integer[] in Java?

I'm new to Java and very confused. I have a large dataset of length 4 int[] and I want to count …

java arrays generics collections
Which is more efficient, a for-each loop, or an iterator?

Which is the most efficient way to traverse a collection? List<Integer> a = new ArrayList<Integer>(); …

java collections foreach
How to convert a Java object (bean) to key-value pairs (and vice versa)?

Say I have a very simple java object that only has some getXXX and setXXX properties. This object is used …

java reflection collections javabeans
Converting String array to java.util.List

How do I convert a String array to a java.util.List?

java arrays collections
Sort Java Collection

I have a Java collection: Collection<CustomObject> list = new ArrayList<CustomObject>(); CustomObject has an id field …

java sorting collections
Lambda expression to convert array/List of String to array/List of Integers

Since Java 8 comes with powerful lambda expressions, I would like to write a function to convert a List/array of …

java arrays collections lambda java-8
Checking if a collection is empty in Java: which is the best method?

I have two ways of checking if a List is empty or not if (CollectionUtils.isNotEmpty(listName)) and if (listName != …

java collections is-empty