<dependency>
<groupId>org.ops4j.base</groupId>
<artifactId>ops4j-base-util-collections</artifactId>
<version>1.5.0</version>
</dependency>
import org.ops4j.util.collection.ListBuilder;
...
List<String> myList = ListBuilder.newList().add("apple").add("banana").add("orange").build();
for(String s : myList){
System.out.println(s);
}
import org.ops4j.util.collection.CollectionBuilder;
...
Set<Integer> mySet = CollectionBuilder.newSet().add(1).add(2).add(3).build();
mySet.remove(2);
for(Integer i : mySet){
System.out.println(i);
}
import org.ops4j.util.collection.MapBuilder;
...
Map<String, Integer> myMap = MapBuilder.newMap().put("apple", 1).put("banana", 2).put("orange", 3).build();
for(Map.Entry<String, Integer> entry : myMap.entrySet()){
System.out.println(entry.getKey() + ": " + entry.getValue());
}