org.jjoost.collections
Class MultiMapNesting<V>

java.lang.Object
  extended by org.jjoost.collections.MultiMapNesting<V>

public class MultiMapNesting<V>
extends java.lang.Object

This class encapsulates the concept of nesting for objects that implement MultiMap. Two kinds of nesting are supported: INLINE and NESTED. INLINE indicates that the map should be structurally the same as if it did not support duplicates, only that duplicate records are handled correctly. i.e. an INLINE MultiMap that contains no duplicate keys should look structurally identical to a regular Map. A NESTED MultiMap, however, should store a Set against every single key. If NESTED, a MultiMapNesting requires a Factory> in order to produce each MultiSet we store against each key.


Nested Class Summary
static class MultiMapNesting.Type
          An enumeration of the nesting types for MultiMap
 
Method Summary
 Factory<Set<V>> factory()
          Factory; ignored if type() == INLINE
static
<V> MultiMapNesting<V>
inline()
          Public method for retrieving the MultiMapNesting that represents INLINE nesting
static
<V> MultiMapNesting<V>
nested(Factory<Set<V>> factory)
          Public method for retrieving a MultiMapNesting to represent the required NESTED nesting
static
<V> MultiMapNesting<V>
nestedHash()
          Return a MultiMapNesting of type NESTED, that uses hash sets for the nesting
 MultiMapNesting.Type type()
          INLINE or NESTED
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

type

public MultiMapNesting.Type type()
INLINE or NESTED

Returns:
the type

factory

public Factory<Set<V>> factory()
Factory; ignored if type() == INLINE

Returns:
null if type() == INLINE, otherwise a factory

inline

public static <V> MultiMapNesting<V> inline()
Public method for retrieving the MultiMapNesting that represents INLINE nesting

Returns:
the multi map nesting

nested

public static <V> MultiMapNesting<V> nested(Factory<Set<V>> factory)
Public method for retrieving a MultiMapNesting to represent the required NESTED nesting

Parameters:
factory - the factory
Returns:
the multi map nesting

nestedHash

public static <V> MultiMapNesting<V> nestedHash()
Return a MultiMapNesting of type NESTED, that uses hash sets for the nesting

Returns:
a MultiMapNesting of type NESTED, that uses hash sets for the nesting