net.cscott.jutil

Class Factories

public final class Factories extends Object

Factories consists exclusively of static methods that operate on or return CollectionFactorys.

Version: $Id: Factories.java,v 1.3 2004/01/13 21:40:19 cananian Exp $

Author: Felix S. Klock II

Field Summary
static ListFactoryarrayListFactory
Returns a ListFactory that generates ArrayLists.
static MapFactoryhashMapFactory
A MapFactory that generates HashMaps.
static SetFactoryhashSetFactory
A SetFactory that generates HashSets.
static SetFactorylinearSetFactory
A SetFactory that generates LinearSets backed by ArrayLists.
static ListFactorylinkedListFactory
A ListFactory that generates LinkedLists.
static SetFactorytreeSetFactory
A SetFactory that generates TreeSets.
static SetFactoryworkSetFactory
A SetFactory that generates WorkSets.
Method Summary
static <V> ListFactory<V>arrayListFactory()
static <K,V> MapFactory<K,V>hashMapFactory()
static <V> SetFactory<V>hashSetFactory()
static <V> SetFactory<V>linearSetFactory()
static <V> ListFactory<V>linkedListFactory()
static <K,V> SetFactory<Entry<K,V>>mapSetFactory(MapFactory<K,V> mf)
Returns a SetFactory that generates MapSet views of maps generated by the given MapFactory.
static <K,V> SetFactory<Entry<K,V>>multiMapSetFactory(MultiMapFactory<K,V> mf)
Returns a SetFactory that generates MultiMapSet views of MultiMaps generated by the given MultiMapFactory.
static <V> CollectionFactory<V>noNullCollectionFactory(CollectionFactory<V> cf)
static <V> CollectionFactory<V>synchronizedCollectionFactory(CollectionFactory<V> cf)
Returns a CollectionFactory that generates synchronized (thread-safe) Collections.
static <V> ListFactory<V>synchronizedListFactory(ListFactory<V> lf)
Returns a ListFactory that generates synchronized (thread-safe) Lists.
static <K,V> MapFactory<K,V>synchronizedMapFactory(MapFactory<K,V> mf)
Returns a MapFactory that generates synchronized (thread-safe) Maps.
static <V> SetFactory<V>synchronizedSetFactory(SetFactory<V> sf)
Returns a SetFactory that generates synchronized (thread-safe) Sets.
static <V> SetFactory<V>treeSetFactory()
static <V> SetFactory<V>workSetFactory()

Field Detail

arrayListFactory

public static final ListFactory arrayListFactory
Returns a ListFactory that generates ArrayLists.

hashMapFactory

public static final MapFactory hashMapFactory
A MapFactory that generates HashMaps.

hashSetFactory

public static final SetFactory hashSetFactory
A SetFactory that generates HashSets.

linearSetFactory

public static final SetFactory linearSetFactory
A SetFactory that generates LinearSets backed by ArrayLists.

linkedListFactory

public static final ListFactory linkedListFactory
A ListFactory that generates LinkedLists.

treeSetFactory

public static final SetFactory treeSetFactory
A SetFactory that generates TreeSets.

workSetFactory

public static final SetFactory workSetFactory
A SetFactory that generates WorkSets.

Method Detail

arrayListFactory

public static final <V> ListFactory<V> arrayListFactory()

hashMapFactory

public static final <K,V> MapFactory<K,V> hashMapFactory()

hashSetFactory

public static final <V> SetFactory<V> hashSetFactory()

linearSetFactory

public static final <V> SetFactory<V> linearSetFactory()

linkedListFactory

public static final <V> ListFactory<V> linkedListFactory()

mapSetFactory

public static <K,V> SetFactory<Entry<K,V>> mapSetFactory(MapFactory<K,V> mf)
Returns a SetFactory that generates MapSet views of maps generated by the given MapFactory. These can be passed in as arguments to a GenericMultiMap, for example, to make a multimap of maps.

multiMapSetFactory

public static <K,V> SetFactory<Entry<K,V>> multiMapSetFactory(MultiMapFactory<K,V> mf)
Returns a SetFactory that generates MultiMapSet views of MultiMaps generated by the given MultiMapFactory. These can be passed in as arguments to a GenericMultiMap, for example, to make a multimap of multimaps.

noNullCollectionFactory

public static <V> CollectionFactory<V> noNullCollectionFactory(CollectionFactory<V> cf)

synchronizedCollectionFactory

public static <V> CollectionFactory<V> synchronizedCollectionFactory(CollectionFactory<V> cf)
Returns a CollectionFactory that generates synchronized (thread-safe) Collections. The Collections generated are backed by the Collections generated by cf.

See Also: Collections#synchronizedCollection

synchronizedListFactory

public static <V> ListFactory<V> synchronizedListFactory(ListFactory<V> lf)
Returns a ListFactory that generates synchronized (thread-safe) Lists. The Lists generated are backed by the Lists generated by lf.

See Also: Collections#synchronizedList

synchronizedMapFactory

public static <K,V> MapFactory<K,V> synchronizedMapFactory(MapFactory<K,V> mf)
Returns a MapFactory that generates synchronized (thread-safe) Maps. The Maps generated are backed by the Map generated by mf.

See Also: Collections#synchronizedMap

synchronizedSetFactory

public static <V> SetFactory<V> synchronizedSetFactory(SetFactory<V> sf)
Returns a SetFactory that generates synchronized (thread-safe) Sets. The Sets generated are backed by the Sets generated by sf.

See Also: Collections#synchronizedSet

treeSetFactory

public static final <V> SetFactory<V> treeSetFactory()

workSetFactory

public static final <V> SetFactory<V> workSetFactory()
Copyright © 2003 C. Scott Ananian