org.javimmutable.collections.array.bit32
Class EmptyBit32Array<T>

java.lang.Object
  extended by org.javimmutable.collections.common.AbstractJImmutableArray<T>
      extended by org.javimmutable.collections.array.bit32.Bit32Array<T>
          extended by org.javimmutable.collections.array.bit32.EmptyBit32Array<T>
All Implemented Interfaces:
Iterable<JImmutableMap.Entry<Integer,T>>, Cursorable<JImmutableMap.Entry<Integer,T>>, Indexed<T>, Insertable<JImmutableMap.Entry<Integer,T>>, JImmutableArray<T>

@Immutable
public class EmptyBit32Array<T>
extends Bit32Array<T>


Constructor Summary
EmptyBit32Array()
           
 
Method Summary
 Bit32Array<T> assign(int index, T value)
          Sets the value associated with a specific index.
 Cursor<JImmutableMap.Entry<Integer,T>> cursor()
           
 Bit32Array<T> delete(int index)
          Deletes the entry for the specified index (if any).
 Holder<T> find(int index)
          Return a Holder containing the value associated wth the index or an empty Holder if no value is associated with the index.
 int firstIndex()
           
 T getValueOr(int index, T defaultValue)
          Return the value associated with index or defaultValue if no value is associated.
 int size()
          Return the number of entries in the map.
 
Methods inherited from class org.javimmutable.collections.array.bit32.Bit32Array
checkIndex, deleteAll, get, of, of, of
 
Methods inherited from class org.javimmutable.collections.common.AbstractJImmutableArray
findEntry, getMap, insert, isEmpty, iterator, keysCursor, valuesCursor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EmptyBit32Array

public EmptyBit32Array()
Method Detail

getValueOr

@Nullable
public T getValueOr(int index,
                             @Nullable
                             T defaultValue)
Description copied from interface: JImmutableArray
Return the value associated with index or defaultValue if no value is associated. Note that if defaultValue is an acceptable value to the container then this method will be ambiguous and find() should be used instead.

Parameters:
index - identifies the value to retrieve
defaultValue - value to return if no entry exists for index
Returns:
value associated with index or defaultValue if no value is associated

find

@Nonnull
public Holder<T> find(int index)
Description copied from interface: JImmutableArray
Return a Holder containing the value associated wth the index or an empty Holder if no value is associated with the index.

Parameters:
index - identifies the value to retrieve
Returns:
possibly empty Holder containing any value associated with the index

assign

@Nonnull
public Bit32Array<T> assign(int index,
                                    @Nullable
                                    T value)
Description copied from interface: JImmutableArray
Sets the value associated with a specific index. Index must be non-null but value can be null. If the index already has a value in the map the old value is discarded and the new value is stored in its place. Returns a new PersistentMap reflecting any changes. The original map is always left unchanged.

Specified by:
assign in interface JImmutableArray<T>
Specified by:
assign in class Bit32Array<T>
Parameters:
index - index
value - possibly null value
Returns:
new map reflecting the change

delete

@Nonnull
public Bit32Array<T> delete(int index)
Description copied from interface: JImmutableArray
Deletes the entry for the specified index (if any). Returns a new map if the value was deleted or the current map if the index was not contained in the map.

Specified by:
delete in interface JImmutableArray<T>
Specified by:
delete in class Bit32Array<T>
Parameters:
index - index
Returns:
same or different map depending on whether index was removed

size

public int size()
Description copied from interface: JImmutableArray
Return the number of entries in the map.

Returns:

firstIndex

public int firstIndex()
Specified by:
firstIndex in class Bit32Array<T>

cursor

@Nonnull
public Cursor<JImmutableMap.Entry<Integer,T>> cursor()


Copyright © 2014 Burton Computer Corporation. All rights reserved.