Lists

			
List<String> listSample = new ArrayList<String>();
listSample.add("test.test2.test3");
Integer listSize = listSample.size();

// first the "old school" method

for (int i = 0; i < listSize; i++) {
	String currentString = listSample.get(i);
}

// for each method

for (String current : listSample) {
	// do something with current
	System.out.println("current : " + current);
	String[] strArray = current.split("\\");
	for (String strPart : strArray) {
		System.out.println("part : " + strPart);
	}
}

//
Collections.sort(listSample);
			
			

Sets

			
Set<String> setSample = new HashSet<String>();
setSample.add("string1");
setSample.add("string2");
setSample.add("string1");

for (String current : setSample) {
	System.out.println("current : " + current);
}

List<String> converted = new ArrayList<String>(setSample);
			
			

Maps

The Map Interface allows the Java developer to associate a key to a value inside a data structure

The Map is parametrized for the key and the value types. It allows to add a safety in the data access

			
/**
* the map is usually used in the storage of a properties set
*/
final Map<String, String> mapSample = new HashMap<String, String>();
mapSample.put("sampleKey", "sampleValue");
mapSample.put("theConfigurationPath", "C:/test");

mapSample.put("Family name", "Broussard");

final Integer mapSize = mapSample.size();

for (final Entry<String, String> entry : mapSample.entrySet()) {
    System.out.println("this key : " + entry.getKey() +
				" is associated with this value :" +
				entry.getValue());
}

final String value = mapSample.get("Family name");
System.out.println(value);