org.javimmutable.collections
Interface MutableBuilder<T,C>

All Known Subinterfaces:
JImmutableList.Builder<T>, JImmutableRandomAccessList.Builder<T>
All Known Implementing Classes:
JImmutableArrayList.Builder, JImmutableTreeList.Builder, TrieArray.Builder

public interface MutableBuilder<T,C>

Interface for mutable objects used to produce collections by adding objects to the builder and then calling a build() method. MutableBuilders are required to support unlimited calls to build().


Method Summary
 MutableBuilder<T,C> add(Collection<? extends T> source)
          Adds all values in the Collection to the values included in the collection when build() is called.
 MutableBuilder<T,C> add(Cursor<? extends T> source)
          Adds all values in the Cursor to the values included in the collection when build() is called.
 MutableBuilder<T,C> add(Indexed<? extends T> source)
          Adds all values in the Indexed to the values included in the collection when build() is called.
 MutableBuilder<T,C> add(Indexed<? extends T> source, int offset, int limit)
          Adds all values in the specified range of Indexed to the values included in the collection when build() is called.
 MutableBuilder<T,C> add(Iterator<? extends T> source)
          Adds all values in the Iterator to the values included in the collection when build() is called.
<K extends T>
MutableBuilder<T,C>
add(K... source)
          Adds all values in the array to the values included in the collection when build() is called.
 MutableBuilder<T,C> add(T value)
          Adds the specified value to the values included in the collection when build() is called.
 C build()
          Builds and returns a collection containing all of the added values.
 

Method Detail

add

@Nonnull
MutableBuilder<T,C> add(T value)
Adds the specified value to the values included in the collection when build() is called.

Parameters:
value -
Returns:
the builder (convenience for chaining multiple calls)

build

@Nonnull
C build()
Builds and returns a collection containing all of the added values. Usually build() can only be called once for a single MutableBuilder instance although implementing classes are not required to enforce this restriction.

Returns:
the collection

add

@Nonnull
MutableBuilder<T,C> add(Cursor<? extends T> source)
Adds all values in the Cursor to the values included in the collection when build() is called.

Parameters:
source - Cursor containing values to add
Returns:
the builder (convenience for chaining multiple calls)

add

@Nonnull
MutableBuilder<T,C> add(Iterator<? extends T> source)
Adds all values in the Iterator to the values included in the collection when build() is called.

Parameters:
source - Iterator containing values to add
Returns:
the builder (convenience for chaining multiple calls)

add

@Nonnull
MutableBuilder<T,C> add(Collection<? extends T> source)
Adds all values in the Collection to the values included in the collection when build() is called.

Parameters:
source - Collection containing values to add
Returns:
the builder (convenience for chaining multiple calls)

add

@Nonnull
<K extends T> MutableBuilder<T,C> add(K... source)
Adds all values in the array to the values included in the collection when build() is called.

Parameters:
source - array containing values to add
Returns:
the builder (convenience for chaining multiple calls)

add

@Nonnull
MutableBuilder<T,C> add(Indexed<? extends T> source,
                                int offset,
                                int limit)
Adds all values in the specified range of Indexed to the values included in the collection when build() is called.

Parameters:
source - Indexed containing values to add
Returns:
the builder (convenience for chaining multiple calls)

add

@Nonnull
MutableBuilder<T,C> add(Indexed<? extends T> source)
Adds all values in the Indexed to the values included in the collection when build() is called.

Parameters:
source - Indexed containing values to add
Returns:
the builder (convenience for chaining multiple calls)


Copyright © 2014 Burton Computer Corporation. All rights reserved.