ref_send API 2.17
defensive programming in Java

org.joe_e.array
Interface ArrayBuilder<E>

Type Parameters:
E - the component type of the Array to build
All Known Implementing Classes:
BooleanArray.Builder, ByteArray.Builder, CharArray.Builder, ConstArray.Builder, DoubleArray.Builder, FloatArray.Builder, ImmutableArray.Builder, IntArray.Builder, LongArray.Builder, PowerlessArray.Builder, ShortArray.Builder

public interface ArrayBuilder<E>

A builder of ConstArrays. Each type of ConstArray has a nested class that implements this interface, e.g. ConstArray.Builder.


Method Summary
 void append(E element)
          Appends an element to the Array
 void append(E[] elements)
          Appends all elements from a Java array to the Array
 void append(E[] elements, int off, int len)
          Appends a range of elements from a Java array to the Array
 int length()
          Gets the current number of elements in the Array
 ConstArray<E> snapshot()
          Create a snapshot of the current content.
 

Method Detail

append

void append(E element)
Appends an element to the Array

Parameters:
element - the element to append

append

void append(E[] elements)
Appends all elements from a Java array to the Array

Parameters:
elements - the element to append

append

void append(E[] elements,
            int off,
            int len)
Appends a range of elements from a Java array to the Array

Parameters:
elements - the source array
off - the index of the first element to append
len - the number of elements to append

length

int length()
Gets the current number of elements in the Array

Returns:
the number of elements that have been appended

snapshot

ConstArray<E> snapshot()
Create a snapshot of the current content.

Returns:
a ConstArray containing the elements written so far

ref_send API 2.17
defensive programming in Java

Submit a bug or feature, or get help

Copyright 1998-2009 Waterken Inc. under the terms of the MIT X license.