org.joda.primitives.list.impl
Class ImmutableArrayByteList

java.lang.Object
  extended by org.joda.primitives.collection.impl.AbstractPrimitiveCollectable<Byte>
      extended by org.joda.primitives.collection.impl.AbstractByteCollection
          extended by org.joda.primitives.list.impl.AbstractByteList
              extended by org.joda.primitives.list.impl.ImmutableArrayByteList
All Implemented Interfaces:
Iterable<Byte>, Collection<Byte>, List<Byte>, ByteCollection, PrimitiveCollection<Byte>, ByteIterable, ByteList, PrimitiveList<Byte>, PrimitiveCollectable<Byte>

public final class ImmutableArrayByteList
extends AbstractByteList

Immutable array-based implementation of ByteList for primitive int elements.

This class implements List allowing seamless integration with other APIs.

Add, Remove, Set and Clear are not supported as this class is immutable.

Since:
1.0
Version:
CODE GENERATED
Author:
Stephen Colebourne

Nested Class Summary
 
Nested classes/interfaces inherited from class org.joda.primitives.list.impl.AbstractByteList
AbstractByteList.PListIterator
 
Method Summary
protected  void arrayCopy(int fromIndex, byte[] dest, int destIndex, int size)
          Copies data from this collection into the specified array.
 Object clone()
          Clone implementation that returns this.
 boolean contains(byte value)
          Checks whether this collection contains a specified primitive value.
static ImmutableArrayByteList copyOf(byte[] values)
          Creates a list copying the specified array.
static ImmutableArrayByteList copyOf(Collection<Byte> coll)
          Creates a list copying the values from the specified collection.
static ImmutableArrayByteList empty()
          Gets a list that is empty.
 byte getByte(int index)
          Gets the primitive value at the specified index.
 int size()
          Gets the current size of the collection.
 
Methods inherited from class org.joda.primitives.list.impl.AbstractByteList
add, add, add, add, addAll, addAll, addAll, checkIndex, checkIndexExists, checkRange, checkSetModifiable, clear, equals, first, firstByte, get, hashCode, indexOf, indexOf, indexOf, indexOf, isModifiable, isSetModifiable, iterator, last, lastByte, lastIndexOf, lastIndexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, removeByte, removeByteAt, removeRange, set, set, subList, toByteArray
 
Methods inherited from class org.joda.primitives.collection.impl.AbstractByteCollection
addAll, addAll, addAll, checkAddModifiable, checkRemoveModifiable, contains, containsAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, containsAny, isAddModifiable, isRemoveModifiable, isToPrimitivePossible, remove, removeAll, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, retainAll, toArray, toArray, toByteArray, toByteArray, toObject, toPrimitive, toPrimitiveArray, toString
 
Methods inherited from class org.joda.primitives.collection.impl.AbstractPrimitiveCollectable
isEmpty, optimize
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.joda.primitives.collection.PrimitiveCollection
containsAny
 
Methods inherited from interface org.joda.primitives.PrimitiveCollectable
isEmpty, optimize
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from interface org.joda.primitives.collection.ByteCollection
addAll, addAll, containsAll, containsAll, containsAll, containsAny, containsAny, containsAny, removeAll, removeAll, removeAll, removeAll, removeFirst, retainAll, retainAll, retainAll, toByteArray, toByteArray
 
Methods inherited from interface org.joda.primitives.collection.PrimitiveCollection
containsAny
 
Methods inherited from interface org.joda.primitives.PrimitiveCollectable
isEmpty, optimize
 

Method Detail

empty

public static ImmutableArrayByteList empty()
Gets a list that is empty.


copyOf

public static ImmutableArrayByteList copyOf(byte[] values)
Creates a list copying the specified array.

Parameters:
values - an array of values to copy, null treated as zero size array
Returns:
the created list, not null

copyOf

public static ImmutableArrayByteList copyOf(Collection<Byte> coll)
Creates a list copying the values from the specified collection.

If the collection is an instance of this class, then it is simply returned.

Parameters:
coll - a collection of values to copy, null treated as zero size collection
Returns:
the created list, not null

size

public int size()
Gets the current size of the collection.

Returns:
the current size

getByte

public byte getByte(int index)
Gets the primitive value at the specified index.

Parameters:
index - the index to get from
Returns:
value at the index
Throws:
IndexOutOfBoundsException - if the index is invalid

contains

public boolean contains(byte value)
Checks whether this collection contains a specified primitive value.

This implementation accesses the internal storage array directly.

Specified by:
contains in interface ByteCollection
Overrides:
contains in class AbstractByteList
Parameters:
value - the value to search for
Returns:
true if the value is found

clone

public Object clone()
Clone implementation that returns this.

Specified by:
clone in interface PrimitiveCollectable<Byte>
Overrides:
clone in class AbstractPrimitiveCollectable<Byte>
Returns:
this

arrayCopy

protected void arrayCopy(int fromIndex,
                         byte[] dest,
                         int destIndex,
                         int size)
Copies data from this collection into the specified array. This method is pre-validated.

Overrides:
arrayCopy in class AbstractByteList
Parameters:
fromIndex - the index to start from
dest - the destination array
destIndex - the destination start index
size - the number of items to copy


Copyright © 2005-2010 Joda.org. All Rights Reserved.