Code example for SortedMap

Methods: comparator

0
	 * @see java.util.LinkedHashMap 
	 */ 
	@SuppressWarnings("unchecked") 
	public static <K,V> Map<K,V> createApproximateMap(Object map, int initialCapacity) {
		if (map instanceof SortedMap) {
			return new TreeMap<K,V>(((SortedMap<K,V>) map).comparator());
		} 
		else { 
			return new LinkedHashMap<K,V>(initialCapacity);
		} 
	} 
 
 
	private static abstract class CommonsCollectionFactory { 
		private static Map<String,Object> createListOrderedCaseInsensitiveMap(int initialCapacity) {
			// Commons Collections does not support initial capacity of 0. 
			return new CaseInsensitiveLinkedHashMap<String,Object>(initialCapacity == 0 ? 1 : initialCapacity);
		} 
	} 
 
}