org.h2.dev.util
Class ImmutableArray3<K>

java.lang.Object
  extended by org.h2.dev.util.ImmutableArray3<K>
Type Parameters:
K - the type
All Implemented Interfaces:
java.lang.Iterable<K>

public abstract class ImmutableArray3<K>
extends java.lang.Object
implements java.lang.Iterable<K>

An immutable array.


Constructor Summary
ImmutableArray3()
           
 
Method Summary
 K[] array()
          Get the data.
static
<K> ImmutableArray3<K>
create(K... array)
          Create an immutable array.
static
<K> ImmutableArray3<K>
empty()
          Get an empty immutable array.
abstract  K get(int index)
          Get the entry at this index.
abstract  ImmutableArray3<K> insert(int index, K obj)
          Insert an entry at this index.
 java.util.Iterator<K> iterator()
          Get an iterator over all entries.
abstract  int length()
          Get the length.
abstract  ImmutableArray3<K> remove(int index)
          Remove the entry at this index.
abstract  ImmutableArray3<K> set(int index, K obj)
          Set the entry at this index.
 ImmutableArray3<K> subArray(int fromIndex, int toIndex)
          Get a sub-array.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImmutableArray3

public ImmutableArray3()
Method Detail

length

public abstract int length()
Get the length.

Returns:
the length

get

public abstract K get(int index)
Get the entry at this index.

Parameters:
index - the index
Returns:
the entry

set

public abstract ImmutableArray3<K> set(int index,
                                       K obj)
Set the entry at this index.

Parameters:
index - the index
obj - the object
Returns:
the new immutable array

insert

public abstract ImmutableArray3<K> insert(int index,
                                          K obj)
Insert an entry at this index.

Parameters:
index - the index
obj - the object
Returns:
the new immutable array

remove

public abstract ImmutableArray3<K> remove(int index)
Remove the entry at this index.

Parameters:
index - the index
Returns:
the new immutable array

subArray

public ImmutableArray3<K> subArray(int fromIndex,
                                   int toIndex)
Get a sub-array.

Parameters:
fromIndex - the index of the first entry
toIndex - the end index, plus one
Returns:
the new immutable array

create

public static <K> ImmutableArray3<K> create(K... array)
Create an immutable array.

Parameters:
array - the data
Returns:
the new immutable array

array

public K[] array()
Get the data.

Returns:
the data

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

empty

public static <K> ImmutableArray3<K> empty()
Get an empty immutable array.

Type Parameters:
K - the key type
Returns:
the array

iterator

public java.util.Iterator<K> iterator()
Get an iterator over all entries.

Specified by:
iterator in interface java.lang.Iterable<K>
Returns:
the iterator