org.jboss.portal.common.util
Class CollectionBuilder<C extends java.util.Collection<V>,V>

java.lang.Object
  extended by org.jboss.portal.common.util.CollectionBuilder<C,V>

public class CollectionBuilder<C extends java.util.Collection<V>,V>
extends java.lang.Object

An helper to build collection of object in a simple manner.

Version:
$Revision: 7234 $
Author:
Julien Viet

Method Summary
 CollectionBuilder<C,V> add(V o)
          Add the object to the collection.
 CollectionBuilder<C,V> addAll(java.util.Collection<V> all)
          Add all the objects to the collection.
static
<V> CollectionBuilder<java.util.ArrayList<V>,V>
arrayList()
           
static
<V> CollectionBuilder<java.util.ArrayList<V>,V>
arrayList(V v)
           
static
<C extends java.util.Collection<V>,V>
CollectionBuilder<C,V>
create(C collection)
           
 C get()
           
static
<V> CollectionBuilder<java.util.HashSet<V>,V>
hashSet()
           
static
<V> CollectionBuilder<java.util.HashSet<V>,V>
hashSet(V v)
           
static
<V> CollectionBuilder<java.util.LinkedList<V>,V>
linkedList()
           
static
<V> CollectionBuilder<java.util.LinkedList<V>,V>
linkedList(V v)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static <C extends java.util.Collection<V>,V> CollectionBuilder<C,V> create(C collection)

arrayList

public static <V> CollectionBuilder<java.util.ArrayList<V>,V> arrayList()

arrayList

public static <V> CollectionBuilder<java.util.ArrayList<V>,V> arrayList(V v)

linkedList

public static <V> CollectionBuilder<java.util.LinkedList<V>,V> linkedList()

linkedList

public static <V> CollectionBuilder<java.util.LinkedList<V>,V> linkedList(V v)

hashSet

public static <V> CollectionBuilder<java.util.HashSet<V>,V> hashSet()

hashSet

public static <V> CollectionBuilder<java.util.HashSet<V>,V> hashSet(V v)

add

public CollectionBuilder<C,V> add(V o)
Add the object to the collection.

Parameters:
o - the object to add
Returns:
the builder

addAll

public CollectionBuilder<C,V> addAll(java.util.Collection<V> all)
Add all the objects to the collection.

Parameters:
all - the objects to add
Returns:
the builder

get

public C get()