|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpaul.DataStructs.MapFacts
public abstract class MapFacts
MapFacts
contains several common map factories. For
each kind of map factory, we have a corresponding static method.
Note: some old map factories that used to exist as separate
classes are now static inner classes of this class. They are
provided mostly to simplify porting old code (programmers only have
to change a few import
statements).
Nested Class Summary | |
---|---|
static class |
MapFacts.HashMapFactory<K,V>
Deprecated. As of jpaul 2.2, use hash() instead. |
static class |
MapFacts.TreeMapFactory<K,V>
Deprecated. As of jpaul 2.2, use tree(Comparator) instead. |
Constructor Summary | |
---|---|
MapFacts()
|
Method Summary | ||
---|---|---|
static
|
cow(MapFactory<K,V> underMapFact)
Copy-on-write maps. |
|
static
|
hash()
Returns a map factory that generates LinkedHashMap s. |
|
static
|
noCompTree()
Returns a map factory that generates NoCompTreeMap . |
|
static
|
tree(java.util.Comparator<K> comp)
Returns a map factory that generates TreeMap s. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MapFacts()
Method Detail |
---|
public static <K,V> MapFactory<K,V> hash()
LinkedHashMap
s. LinkedHashMap
s are
great for applications that use a few large maps. They also
offer predictable iteration order (identical to the
insertion order). A LinkedHashMap
s is
only slightly slower than a HashMap
(iteration is
actually faster: linear in the actual size, independent of the
capacity). Therefore, in the interest of simplicity, instead
of a factory for HashMap
s and a factory for
LinkedHashMap
s, jpaul
offers only
the latter.
public static <K,V> MapFactory<K,V> tree(java.util.Comparator<K> comp)
TreeMap
s.
TreeMap
s are great for applications that use many
small maps.
comp
- Comparator used internally by the generated
TreeMap
s.public static <K,V> MapFactory<K,V> cow(MapFactory<K,V> underMapFact)
public static <K,V> MapFactory<K,V> noCompTree()
NoCompTreeMap
. NoCompTreeMap
is a binary
tree-backed map that does not require a user-defined Comparator
between keys.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |