it.unimi.dsi.fastutil.bytes
Class ByteLists.Singleton

java.lang.Object
  extended byit.unimi.dsi.fastutil.bytes.AbstractByteCollection
      extended byit.unimi.dsi.fastutil.bytes.AbstractByteList
          extended byit.unimi.dsi.fastutil.bytes.ByteLists.Singleton
All Implemented Interfaces:
ByteCollection, ByteList, ByteStack, Cloneable, Collection, Comparable, List, Serializable, Stack
Enclosing class:
ByteLists

public static class ByteLists.Singleton
extends AbstractByteList
implements Serializable, Cloneable

An immutable class representing a type-specific singleton list.

This class may be useful to implement your own in case you subclass a type-specific list.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class it.unimi.dsi.fastutil.bytes.AbstractByteList
AbstractByteList.ByteSubList
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean add(byte k)
           
 void add(int i, byte k)
           
 boolean addAll(ByteCollection c)
          Delegates to a more generic method.
 boolean addAll(ByteList c)
          Delegates to a more generic method.
 boolean addAll(Collection c)
          Delegates to a more generic method.
 boolean addAll(int i, ByteCollection c)
          Delegates to a more generic method.
 boolean addAll(int i, ByteList c)
          Delegates to a more generic method.
 boolean addAll(int i, Collection c)
           
 boolean addAll(int i, List c)
           
 boolean addAll(List c)
           
 ByteListIterator byteListIterator()
          Delegates to the corresponding list-iterator method.
 ByteListIterator byteListIterator(int i)
          Returns a type-specific list iterator on the list starting at a given index.
 ByteList byteSubList(int from, int to)
           
 void clear()
           
 Object clone()
           
 boolean contains(byte k)
           
 byte getByte(int i)
           
 boolean rem(byte k)
          Note that this method should be called remove(), but the clash with the similarly named index-based method in the List interface forces us to use a distinguished name.
 boolean removeAll(ByteCollection c)
          Remove from this collection all elements in the given type-specific collection.
 boolean removeAll(Collection c)
          Remove from this collection all elements in the given collection.
 byte removeByte(int i)
           
 boolean retainAll(ByteCollection c)
          Retains in this collection only elements from the given type-specific collection.
 boolean retainAll(Collection c)
          Retains in this collection only elements from the given collection.
 int size()
           
 void size(int size)
          Sets the size of this list.
 byte[] toByteArray()
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.bytes.AbstractByteList
add, addElements, addElements, byteIterator, compareTo, equals, get, getElements, hashCode, indexOf, indexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, peek, peekByte, pop, popByte, push, push, remove, removeElements, set, set, subList, top, topByte, toString
 
Methods inherited from class it.unimi.dsi.fastutil.bytes.AbstractByteCollection
add, contains, containsAll, containsAll, isEmpty, iterator, rem, remove, toArray, toArray, toArray, toByteArray
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, contains, containsAll, isEmpty, iterator, remove, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.bytes.ByteCollection
containsAll, toArray, toByteArray
 
Methods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Method Detail

rem

public boolean rem(byte k)
Description copied from interface: ByteCollection
Note that this method should be called remove(), but the clash with the similarly named index-based method in the List interface forces us to use a distinguished name. For simplicity, the set interfaces reinstates remove().

Specified by:
rem in interface ByteCollection
Overrides:
rem in class AbstractByteList

add

public boolean add(byte k)
Specified by:
add in interface ByteCollection
Overrides:
add in class AbstractByteList

add

public void add(int i,
                byte k)
Specified by:
add in interface ByteList
Overrides:
add in class AbstractByteList

getByte

public byte getByte(int i)
Specified by:
getByte in interface ByteList
See Also:
List.get(int)

removeByte

public byte removeByte(int i)
Specified by:
removeByte in interface ByteList
Overrides:
removeByte in class AbstractByteList

contains

public boolean contains(byte k)
Specified by:
contains in interface ByteCollection
Overrides:
contains in class AbstractByteList

addAll

public boolean addAll(ByteList c)
Description copied from class: AbstractByteList
Delegates to a more generic method.

Specified by:
addAll in interface ByteList
Overrides:
addAll in class AbstractByteList

addAll

public boolean addAll(ByteCollection c)
Description copied from class: AbstractByteList
Delegates to a more generic method.

Specified by:
addAll in interface ByteCollection
Overrides:
addAll in class AbstractByteList

addAll

public boolean addAll(int i,
                      ByteList c)
Description copied from class: AbstractByteList
Delegates to a more generic method.

Specified by:
addAll in interface ByteList
Overrides:
addAll in class AbstractByteList

addAll

public boolean addAll(int i,
                      ByteCollection c)
Description copied from class: AbstractByteList
Delegates to a more generic method.

Specified by:
addAll in interface ByteList
Overrides:
addAll in class AbstractByteList

removeAll

public boolean removeAll(ByteCollection c)
Description copied from class: AbstractByteCollection
Remove from this collection all elements in the given type-specific collection.

Specified by:
removeAll in interface ByteCollection
Overrides:
removeAll in class AbstractByteCollection
Parameters:
c - a type-specific collection.
Returns:
true if this collection changed as a result of the call.

retainAll

public boolean retainAll(ByteCollection c)
Description copied from class: AbstractByteCollection
Retains in this collection only elements from the given type-specific collection.

Specified by:
retainAll in interface ByteCollection
Overrides:
retainAll in class AbstractByteCollection
Parameters:
c - a type-specific collection.
Returns:
true if this collection changed as a result of the call.

addAll

public boolean addAll(List c)

addAll

public boolean addAll(Collection c)
Description copied from class: AbstractByteList
Delegates to a more generic method.

Specified by:
addAll in interface List
Overrides:
addAll in class AbstractByteList

addAll

public boolean addAll(int i,
                      List c)

addAll

public boolean addAll(int i,
                      Collection c)
Specified by:
addAll in interface List
Overrides:
addAll in class AbstractByteList

removeAll

public boolean removeAll(Collection c)
Description copied from class: AbstractByteCollection
Remove from this collection all elements in the given collection. If the collection is an instance of this class, it uses faster iterators.

Specified by:
removeAll in interface List
Overrides:
removeAll in class AbstractByteCollection
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

retainAll

public boolean retainAll(Collection c)
Description copied from class: AbstractByteCollection
Retains in this collection only elements from the given collection.

Specified by:
retainAll in interface List
Overrides:
retainAll in class AbstractByteCollection
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

toByteArray

public byte[] toByteArray()
Description copied from interface: ByteCollection
Returns a primitive type array containing the items of this collection.

Specified by:
toByteArray in interface ByteCollection
Overrides:
toByteArray in class AbstractByteCollection

byteListIterator

public ByteListIterator byteListIterator()
Description copied from class: AbstractByteList
Delegates to the corresponding list-iterator method.

Specified by:
byteListIterator in interface ByteList
Overrides:
byteListIterator in class AbstractByteList

byteListIterator

public ByteListIterator byteListIterator(int i)
Description copied from interface: ByteList
Returns a type-specific list iterator on the list starting at a given index.

The iterator returned by the List.listIterator() method and by this method are identical; however, using this method you can save a type casting.

Specified by:
byteListIterator in interface ByteList
Overrides:
byteListIterator in class AbstractByteList

byteSubList

public ByteList byteSubList(int from,
                            int to)
Specified by:
byteSubList in interface ByteList
Overrides:
byteSubList in class AbstractByteList

size

public int size()
Specified by:
size in interface List

size

public void size(int size)
Description copied from interface: ByteList
Sets the size of this list.

If the specified size is smaller than the current size, the last elements are discarded. Otherwise, they are filled with 0/null/false.

Specified by:
size in interface ByteList
Overrides:
size in class AbstractByteList

clear

public void clear()
Specified by:
clear in interface List
Overrides:
clear in class AbstractByteCollection

clone

public Object clone()