/** * Returns a map that maintains the order of keys that are added * backed by the given map. * <p> * If a key is added twice, the order is determined by the first add. * The order is observed through the keySet, values and entrySet. * * @param map the map to order, must not be null * @return an ordered map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map orderedMap(Map map) { return ListOrderedMap.decorate(map); }
/** * Returns a map that maintains the order of keys that are added * backed by the given map. * <p> * If a key is added twice, the order is determined by the first add. * The order is observed through the keySet, values and entrySet. * * @param map the map to order, must not be null * @return an ordered map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map orderedMap(Map map) { return ListOrderedMap.decorate(map); }
public Map makeEmptyMap() { return ListOrderedMap.decorate(new HashMap()); }
public Map getMap() { Map testMap = ListOrderedMap.decorate(new HashMap()); testMap.put("A", "a"); testMap.put("B", "b"); testMap.put("C", "c"); return testMap; }
public Map makeEmptyMap() { // need an empty singleton map, but thats not possible // use a ridiculous fake instead to make the tests pass return UnmodifiableOrderedMap.decorate(ListOrderedMap.decorate(new HashMap())); }
public Map makeEmptyMap() { return UnmodifiableOrderedMap.decorate(ListOrderedMap.decorate(new HashMap())); }
public Map makeFullMap() { OrderedMap m = ListOrderedMap.decorate(new HashMap()); addSampleMappings(m); return UnmodifiableOrderedMap.decorate(m); }
public MapIterator makeEmptyMapIterator() { return UnmodifiableOrderedMapIterator.decorate( ListOrderedMap.decorate(new HashMap()).orderedMapIterator()); }
/** * Returns a map that maintains the order of keys that are added * backed by the given map. * <p> * If a key is added twice, the order is determined by the first add. * The order is observed through the keySet, values and entrySet. * * @param map the map to order, must not be null * @return an ordered map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map orderedMap(Map map) { return ListOrderedMap.decorate(map); }
/** * Returns a map that maintains the order of keys that are added * backed by the given map. * <p> * If a key is added twice, the order is determined by the first add. * The order is observed through the keySet, values and entrySet. * * @param map the map to order, must not be null * @return an ordered map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map orderedMap(Map map) { return ListOrderedMap.decorate(map); }
/** * Returns a map that maintains the order of keys that are added * backed by the given map. * <p> * If a key is added twice, the order is determined by the first add. * The order is observed through the keySet, values and entrySet. * * @param map the map to order, must not be null * @return an ordered map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map orderedMap(Map map) { return ListOrderedMap.decorate(map); }
/** * Returns a map that maintains the order of keys that are added * backed by the given map. * <p> * If a key is added twice, the order is determined by the first add. * The order is observed through the keySet, values and entrySet. * * @param map the map to order, must not be null * @return an ordered map backed by the given map * @throws IllegalArgumentException if the Map is null */ public static Map orderedMap(Map map) { return ListOrderedMap.decorate(map); }
/** * Creates an attribute map as needed by HtmlElement. This is just used by the element factories. * @param attributeCount the initial number of attributes to be added to the map * @return the attribute map */ @SuppressWarnings("unchecked") static Map<String, DomAttr> createAttributeMap(final int attributeCount) { return ListOrderedMap.decorate(new HashMap<String, DomAttr>(attributeCount)); // preserve insertion order }
/** * Creates an attribute map as needed by HtmlElement. This is just used by the element factories. * @param attributeCount the initial number of attributes to be added to the map * @return the attribute map */ @SuppressWarnings("unchecked") static Map<String, DomAttr> createAttributeMap(final int attributeCount) { return ListOrderedMap.decorate(new HashMap<String, DomAttr>(attributeCount)); // preserve insertion order }
/** * Creates an attribute map as needed by HtmlElement. This is just used by the element factories. * @param attributeCount the initial number of attributes to be added to the map * @return the attribute map */ @SuppressWarnings("unchecked") static Map<String, DomAttr> createAttributeMap(final int attributeCount) { return ListOrderedMap.decorate(new HashMap<String, DomAttr>(attributeCount)); // preserve insertion order }
@SuppressWarnings("unchecked") @Override protected Map<String, List<Object>> createImmutableAttributeMap(int size) { return ListOrderedMap.decorate(new CaseInsensitiveMap(size > 0 ? size : 1)); } }
/** * Create a Map instance to be used as attribute map. * <br/> * By default, a linked case-insensitive Map will be created * * @param attributeCount the attribute count, to be used as initial capacity for the Map * @return the new Map instance */ @SuppressWarnings("unchecked") protected Map<String, Object> createAttributeMap(int attributeCount) { return ListOrderedMap.decorate(new CaseInsensitiveMap(attributeCount > 0 ? attributeCount : 1)); }
@SuppressWarnings("unchecked") @Override protected Map<String, List<Object>> createImmutableAttributeMap(int size) { return ListOrderedMap.decorate(new CaseInsensitiveMap(size > 0 ? size : 1)); } }
/** * Create a Map instance to be used as column map. * <br/> * By default, a linked case-insensitive Map will be created * * @param columnCount the column count, to be used as initial capacity for the Map * @return the new Map instance */ @SuppressWarnings("unchecked") protected Map<String, Object> createColumnMap(int columnCount) { return ListOrderedMap.decorate(new CaseInsensitiveMap(columnCount > 0 ? columnCount : 1)); }
private static Map createListOrderedCaseInsensitiveMap(int initialCapacity) { // Commons Collections does not support initial capacity of 0. return ListOrderedMap.decorate(new CaseInsensitiveMap(initialCapacity == 0 ? 1 : initialCapacity)); }