ref_send API 1.16
defensive programming in Java

org.joe_e.array
Class PowerlessArray<E>

java.lang.Object
  extended by org.joe_e.array.ConstArray<E>
      extended by org.joe_e.array.ImmutableArray<E>
          extended by org.joe_e.array.PowerlessArray<E>
Type Parameters:
E - the element type of objects contained in the array
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<E>, Immutable, Powerless, Selfless
Direct Known Subclasses:
BooleanArray, ByteArray, CharArray, DoubleArray, FloatArray, IntArray, LongArray, ShortArray

public class PowerlessArray<E>
extends ImmutableArray<E>
implements Powerless

An immutable array containing powerless objects.

See Also:
Serialized Form

Nested Class Summary
static class PowerlessArray.Builder<E>
          A PowerlessArray factory.
 
Method Summary
static
<E> PowerlessArray<E>
array(E... values)
          Constuct a PowerlessArray.
static
<E> PowerlessArray.Builder<E>
builder()
          Get a PowerlessArray.Builder.
static
<E> PowerlessArray.Builder<E>
builder(int estimate)
          Get a PowerlessArray.Builder.
 PowerlessArray<E> with(E newE)
          Return a new PowerlessArray that contains the same elements as this one but with a new element added to the end.
 PowerlessArray<E> without(int i)
          Return a new PowerlessArray that contains the same elements as this one excluding the element at a specified index
 
Methods inherited from class org.joe_e.array.ConstArray
array, equals, get, hashCode, iterator, length, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

array

public static <E> PowerlessArray<E> array(E... values)
Constuct a PowerlessArray. The type will be

Parameters:
values - each value, or an array of values
Throws:
java.lang.ClassCastException - if the runtime component type of values is not powerless in the overlay type system

with

public PowerlessArray<E> with(E newE)
Return a new PowerlessArray that contains the same elements as this one but with a new element added to the end.

Overrides:
with in class ImmutableArray<E>
Parameters:
newE - an element to add
Returns:
the new array
Throws:
java.lang.ClassCastException - if newE is not powerless

without

public PowerlessArray<E> without(int i)
Return a new PowerlessArray that contains the same elements as this one excluding the element at a specified index

Overrides:
without in class ImmutableArray<E>
Parameters:
i - the index of the element to exclude
Returns:
the new array

builder

public static <E> PowerlessArray.Builder<E> builder()
Get a PowerlessArray.Builder. This is equivalent to the constructor.

Returns:
a new builder instance, with the default internal array length

builder

public static <E> PowerlessArray.Builder<E> builder(int estimate)
Get a PowerlessArray.Builder. This is equivalent to the constructor.

Parameters:
estimate - estimated array length
Returns:
a new builder instance

ref_send API 1.16
defensive programming in Java

Submit a bug or feature, or get help

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