com.hazelcast.multimap.impl
Class ValueCollectionFactory

java.lang.Object
  extended by com.hazelcast.multimap.impl.ValueCollectionFactory

public final class ValueCollectionFactory
extends Object

Multi-map values are backed by collections which are created by static factory methods in this class.


Method Summary
static
<T> Collection<T>
createCollection(Collection collection)
          Creates a same type collection with the given collection depending on the MultiMapConfig.valueCollectionType.
static
<T> Collection<T>
createCollection(MultiMapConfig.ValueCollectionType collectionType)
          Picks right collection type, like Set or List depending on the MultiMapConfig.valueCollectionType and creates it.
static
<T> Collection<T>
createCollection(MultiMapConfig.ValueCollectionType collectionType, int initialCapacity)
          Picks right collection type, like Set or List depending on the MultiMapConfig.valueCollectionType and creates it.
static
<T> Collection<T>
emptyCollection(MultiMapConfig.ValueCollectionType collectionType)
          Picks right empty collection type, like Collections.emptySet() or Collections.emptyList() )} depending on the MultiMapConfig.valueCollectionType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createCollection

public static <T> Collection<T> createCollection(MultiMapConfig.ValueCollectionType collectionType)
Picks right collection type, like Set or List depending on the MultiMapConfig.valueCollectionType and creates it.

Parameters:
collectionType - one of MultiMapConfig.ValueCollectionType.SET or MultiMapConfig.ValueCollectionType.LIST
Returns:
Set or List depending on the collectionType argument
Throws:
IllegalArgumentException

createCollection

public static <T> Collection<T> createCollection(MultiMapConfig.ValueCollectionType collectionType,
                                                 int initialCapacity)
Picks right collection type, like Set or List depending on the MultiMapConfig.valueCollectionType and creates it.

Parameters:
collectionType - one of MultiMapConfig.ValueCollectionType.SET or MultiMapConfig.ValueCollectionType#LIST
initialCapacity - if smaller than or equals to 0 falls back to default initial capacity of corresponding collection.
Returns:
Set or List depending on the collectionType argument
Throws:
IllegalArgumentException

createCollection

public static <T> Collection<T> createCollection(Collection collection)
Creates a same type collection with the given collection depending on the MultiMapConfig.valueCollectionType.

Parameters:
collection - to be asked to return a new appropriate implementation instance according to MultiMapConfig.ValueCollectionType
Returns:
Set or List depending on the collectionType argument
Throws:
IllegalArgumentException

emptyCollection

public static <T> Collection<T> emptyCollection(MultiMapConfig.ValueCollectionType collectionType)
Picks right empty collection type, like Collections.emptySet() or Collections.emptyList() )} depending on the MultiMapConfig.valueCollectionType

Parameters:
collectionType - one of MultiMapConfig.ValueCollectionType#SET or MultiMapConfig.ValueCollectionType#LIST
Returns:
empty collection like Collections.emptySet() depending on the collectionType argument
Throws:
IllegalArgumentException


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.