org.joe_e.array
Class LongArray.Builder

java.lang.Object
  extended by org.joe_e.array.ConstArray.Builder<E>
      extended by org.joe_e.array.ImmutableArray.Builder<E>
          extended by org.joe_e.array.PowerlessArray.Builder<Long>
              extended by org.joe_e.array.LongArray.Builder
All Implemented Interfaces:
ArrayBuilder<Long>
Enclosing class:
LongArray

public static final class LongArray.Builder
extends PowerlessArray.Builder<Long>

A LongArray factory.


Method Summary
 void append(long newLong)
          Append a long
 void append(Long newLong)
          Append a Long
 void append(long[] newLongs)
          Append an array of longs
 void append(Long[] newLongs)
          Append an array of Longs
 void append(long[] newLongs, int off, int len)
          Append a range of elements from an array of longs
 void append(Long[] newLongs, int off, int len)
          Append a range of elements from an array of Longs
 LongArray snapshot()
          Create a snapshot of the current content.
 
Methods inherited from class org.joe_e.array.ConstArray.Builder
length
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

append

public void append(Long newLong)
Append a Long

Specified by:
append in interface ArrayBuilder<Long>
Overrides:
append in class PowerlessArray.Builder<Long>
Parameters:
newLong - the element to add
Throws:
NegativeArraySizeException - if the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

append

public void append(Long[] newLongs)
Append an array of Longs

Specified by:
append in interface ArrayBuilder<Long>
Overrides:
append in class PowerlessArray.Builder<Long>
Parameters:
newLongs - the elements to add
Throws:
IndexOutOfBoundsException - if the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

append

public void append(Long[] newLongs,
                   int off,
                   int len)
Append a range of elements from an array of Longs

Specified by:
append in interface ArrayBuilder<Long>
Overrides:
append in class PowerlessArray.Builder<Long>
Parameters:
newLongs - the array to add elements from
off - the index of the first element to add
len - the number of elements to add
Throws:
IndexOutOfBoundsException - if an out-of-bounds index would be referenced or the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

snapshot

public LongArray snapshot()
Create a snapshot of the current content.

Specified by:
snapshot in interface ArrayBuilder<Long>
Overrides:
snapshot in class PowerlessArray.Builder<Long>
Returns:
a LongArray containing the elements so far

append

public void append(long newLong)
Append a long

Parameters:
newLong - the element to add
Throws:
NegativeArraySizeException - if the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

append

public void append(long[] newLongs)
Append an array of longs

Parameters:
newLongs - the elements to add
Throws:
IndexOutOfBoundsException - if the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.

append

public void append(long[] newLongs,
                   int off,
                   int len)
Append a range of elements from an array of longs

Parameters:
newLongs - the array to add elements from
off - the index of the first element to add
len - the number of elements to add
Throws:
IndexOutOfBoundsException - if an out-of-bounds index would be referenced or the resulting internal array would exceed the maximum length of a Java array. The builder is unmodified.