20 package org.matsim.core.utils.collections;
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import java.util.HashMap;
25 import java.util.HashSet;
26 import java.util.List;
50 final Map<K, Collection<V>> map) {
51 Collection<V> coll = map.get( key );
54 coll =
new ArrayList<V>();
55 map.put( key , coll );
72 final Map<K, List<V>> map) {
73 List<V> coll = map.get( key );
76 coll =
new ArrayList<V>();
77 map.put( key , coll );
94 final Map<K, Set<V>> map) {
95 Set<V> coll = map.get( key );
98 coll =
new HashSet<V>();
99 map.put( key , coll );
117 final Map<K, Map<C,V>> map) {
118 Map<C,V> coll = map.get( key );
120 if ( coll == null ) {
121 coll =
new HashMap<C,V>();
122 map.put( key , coll );
142 T coll = map.get( key );
144 if ( coll == null ) {
146 map.put( key , coll );
163 final Map<K, Double> map,
164 final double initialValue) {
165 Double d = map.get( key );
188 final Map<K, Double> map,
189 final double initialValue,
190 final double toAdd) {
191 final double newValue =
194 map.put( key , newValue );
210 final Map<K, Integer> map,
211 final int initialValue) {
212 Integer i = map.get( key );
235 final Map<K, Integer> map,
236 final int initialValue,
241 map.put( key , newValue );
255 public static <K,V> Collection<V>
get(
257 final Map<K, V> map ) {
258 final List<V> coll =
new ArrayList<V>();
260 for ( K k : keys ) coll.add( map.get( k ) );
278 this.theClass = theClass;
288 return theClass.getConstructor().newInstance();
static< K > Integer getInteger(final K key, final Map< K, Integer > map, final int initialValue)
static< K, V > Set< V > getSet(final K key, final Map< K, Set< V >> map)
static< K > double addToInteger(final K key, final Map< K, Integer > map, final int initialValue, final int toAdd)
DefaultFactory(final Class<? extends T > theClass)
static< K, V > List< V > getList(final K key, final Map< K, List< V >> map)
static< K > Double getDouble(final K key, final Map< K, Double > map, final double initialValue)
static< K, C, V > Map< C, V > getMap(final K key, final Map< K, Map< C, V >> map)
static< K, T > T getArbitraryObject(final K key, final Map< K, T > map, final Factory< T > fact)
static< K > double addToDouble(final K key, final Map< K, Double > map, final double initialValue, final double toAdd)
final Class<? extends T > theClass
static< K, V > Collection< V > getCollection(final K key, final Map< K, Collection< V >> map)