com.atlassian.jira.util.collect
Class CollectionBuilder<T>

java.lang.Object
  extended by com.atlassian.jira.util.collect.CollectionBuilder<T>
Type Parameters:
T - contained in the created collections.

@NotThreadSafe
public final class CollectionBuilder<T>
extends Object

Convenience class for creating collections (Set and List) instances or enclosed iterables.

The default methods asList() and asSet() and asSortedSet() create immutable collections.


Method Summary
 CollectionBuilder<T> add(T element)
           
 CollectionBuilder<T> addAll(Collection<? extends T> elements)
           
<E extends T>
CollectionBuilder<T>
addAll(E... elements)
           
 List<T> asArrayList()
           
 Collection<T> asCollection()
           
 EnclosedIterable<T> asEnclosedIterable()
           
 Set<T> asHashSet()
           
 Set<T> asImmutableListOrderedSet()
           
 List<T> asLinkedList()
           
 List<T> asList()
           
 Set<T> asListOrderedSet()
           
 Collection<T> asMutableCollection()
           
 List<T> asMutableList()
           
 Set<T> asMutableSet()
           
 SortedSet<T> asMutableSortedSet()
           
 Set<T> asSet()
           
 SortedSet<T> asSortedSet()
           
 SortedSet<T> asTreeSet()
           
static
<T> CollectionBuilder<T>
newBuilder()
           
static
<T> CollectionBuilder<T>
newBuilder(Collection<? extends T> elements)
           
static
<T> CollectionBuilder<T>
newBuilder(T... elements)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

newBuilder

public static <T> CollectionBuilder<T> newBuilder()

newBuilder

public static <T> CollectionBuilder<T> newBuilder(T... elements)

newBuilder

public static <T> CollectionBuilder<T> newBuilder(Collection<? extends T> elements)

add

public CollectionBuilder<T> add(T element)

addAll

public <E extends T> CollectionBuilder<T> addAll(E... elements)

addAll

public CollectionBuilder<T> addAll(Collection<? extends T> elements)

asCollection

public Collection<T> asCollection()

asMutableCollection

public Collection<T> asMutableCollection()

asArrayList

public List<T> asArrayList()

asLinkedList

public List<T> asLinkedList()

asList

public List<T> asList()

asMutableList

public List<T> asMutableList()

asHashSet

public Set<T> asHashSet()

asListOrderedSet

public Set<T> asListOrderedSet()

asImmutableListOrderedSet

public Set<T> asImmutableListOrderedSet()

asSet

public Set<T> asSet()

asMutableSet

public Set<T> asMutableSet()

asTreeSet

public SortedSet<T> asTreeSet()

asSortedSet

public SortedSet<T> asSortedSet()

asMutableSortedSet

public SortedSet<T> asMutableSortedSet()

asEnclosedIterable

public EnclosedIterable<T> asEnclosedIterable()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2002-2012 Atlassian. All Rights Reserved.