check for nulls checkNotNull(T); NullPointerException or <T> check valid elements in lists, string or array checkElementIndexI (int index, int size); IndexOutOfBoundsException check for valid positions in list, string or array (really usefull?) checkPositionIndex (int index, int size); IndexOutOfBoundsException
allowed to appear more than once _the order is irrelevant: {x, y, y} == {y, x, y} _can be viewed as ArrayList<E> without ordering or Map<E, Integer> with elements and counts multiset count(Object): returns count associated with that element elementSet(): returns a Set<E> with the distinct elements of multiset entrySet(): returns Set<MultiSet. Entry<E>> which works as entry-set of Map<E>
to Map<K, List<V>> or Map<K, Set<V>> _useful implementations _conceptually can think about multimap as: a collection of mappings from single keys to single values: a -> 1 a -> 2 a -> 4 b -> 3 c -> 5 or as a mapping from unique keys to collections of values: a -> [1, 2, 4] b -> 3 c -> 5
weightedGraph.put(v1, v3, 20); weightedGraph.put(v2, v3, 5); weightedGraph.row(v1); weightedGraph.column(v3); _really a table like collection, surprise? _can access it as Map with rowMap() or as Set with rowKeySet() _implementations like HashBasedTable, TreeBasedTable, ImmutableBasedTable or ArrayTable
of that type _eliminate need of casting with getInstance(Class<T>) and T putInstance(Class<T>, T) ClassToInstanceMap<Number> numbers = MutableClassToInstanceMap.create(); numbers.putInstance(Integer.class, Integer.valueOf(0)); numbers.putInstance(Double.class, Double.valueOf(1)); numbers.putInstance(Float.class, Float.valueOf(3));