Top "Collections" questions

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

How do I sort a Set to a List in Java?

In Java, I have a Set, and I want to turn it into a sorted List. Is there a method …

java sorting collections
Java Ordered Map

In Java, Is there an object that acts like a Map for storing and accessing key/value pairs, but can …

java collections
Check a collection size with JSTL

How can I check the size of a collection with JSTL? Something like: <c:if test="${companies.size() > 0}"&…

jsp collections jstl
How to quickly and conveniently create a one element arraylist

Is there a Utility method somewhere that can do this in 1 line? I can't find it anywhere in Collections, or …

java arraylist collections
How to iterate over a TreeMap?

Possible Duplicate: How do I iterate over each Entry in a Map? I want to iterate over a TreeMap, and …

java collections treemap
Java: how to convert HashMap<String, Object> to array

I need to convert a HashMap<String, Object> to an array; could anyone show me how it's done?

java arrays collections hashmap
Filtering collections in C#

I am looking for a very fast way to filter down a collection in C#. I am currently using generic …

c# collections filtering
How to easily initialize a list of Tuples?

I love tuples. They allow you to quickly group relevant information together without having to write a struct or class …

c# list collections .net-4.0 tuples
how to get the one entry from hashmap without iterating

Is there a elegant way of obtaining only one Entry<K,V> from HashMap, without iterating, if key …

java collections
How do you cast a List of supertypes to a List of subtypes?

For example, lets say you have two classes: public class TestA {} public class TestB extends TestA{} I have a method …

java list generics collections casting