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

java.lang.Object
  extended by java.util.AbstractCollection<Byte>
      extended by it.unimi.dsi.fastutil.bytes.AbstractByteCollection
          extended by it.unimi.dsi.fastutil.bytes.AbstractByteList
              extended by it.unimi.dsi.fastutil.bytes.ByteLists.Singleton
All Implemented Interfaces:
ByteCollection, ByteIterable, ByteList, ByteStack, Stack<Byte>, Serializable, Cloneable, Comparable<List<? extends Byte>>, Iterable<Byte>, Collection<Byte>, List<Byte>
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/interfaces inherited from class it.unimi.dsi.fastutil.bytes.AbstractByteList
AbstractByteList.ByteSubList
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean addAll(ByteCollection c)
          Adds all elements of the given type-specific collection to this collection.
 boolean addAll(Collection<? extends Byte> c)
          Delegates to a more generic method.
 boolean addAll(int i, ByteCollection c)
          Delegates to a more generic method.
 boolean addAll(int i, Collection<? extends Byte> c)
           
 void clear()
           
 Object clone()
           
 boolean contains(byte k)
           
 byte getByte(int i)
           
 ByteListIterator iterator()
          Returns a type-specific iterator on the elements of this collection.
 ByteListIterator listIterator()
          Returns a type-specific list iterator on the list.
 ByteListIterator listIterator(int i)
          Returns a type-specific list iterator on the list starting at a given index.
 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(Collection<?> c)
          Remove from this collection all elements in the given collection.
 byte removeByte(int i)
           
 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.
 ByteList subList(int from, int to)
          Returns a type-specific view of the portion of this list from the index from, inclusive, to the index to, exclusive.
 byte[] toByteArray()
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.bytes.AbstractByteList
add, add, add, addAll, addAll, addElements, addElements, byteListIterator, byteListIterator, byteSubList, compareTo, ensureIndex, ensureRestrictedIndex, equals, get, getElements, hashCode, indexOf, indexOf, lastIndexOf, lastIndexOf, peek, peekByte, pop, popByte, push, push, remove, remove, removeElements, set, set, top, topByte, toString
 
Methods inherited from class it.unimi.dsi.fastutil.bytes.AbstractByteCollection
add, byteIterator, contains, containsAll, containsAll, isEmpty, rem, removeAll, retainAll, toArray, toArray, toArray, toByteArray
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, contains, containsAll, isEmpty, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.bytes.ByteCollection
byteIterator, containsAll, removeAll, retainAll, toArray, 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

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
See Also:
List.remove(int)

contains

public boolean contains(byte k)
Specified by:
contains in interface ByteCollection
Overrides:
contains in class AbstractByteList
See Also:
Collection.contains(Object)

addAll

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

Specified by:
addAll in interface Collection<Byte>
Specified by:
addAll in interface List<Byte>
Overrides:
addAll in class AbstractByteList
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

addAll

public boolean addAll(int i,
                      Collection<? extends Byte> c)
Specified by:
addAll in interface List<Byte>
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 Collection<Byte>
Specified by:
removeAll in interface List<Byte>
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 Collection<Byte>
Specified by:
retainAll in interface List<Byte>
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
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray()

listIterator

public ByteListIterator listIterator()
Description copied from interface: ByteList
Returns a type-specific list iterator on the list.

Specified by:
listIterator in interface ByteList
Specified by:
listIterator in interface List<Byte>
Overrides:
listIterator in class AbstractByteList
See Also:
List.listIterator()

iterator

public ByteListIterator iterator()
Description copied from interface: ByteCollection
Returns a type-specific iterator on the elements of this collection.

Note that this specification strengthens the one given in Iterable.iterator(), which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extends Collection.

Specified by:
iterator in interface ByteCollection
Specified by:
iterator in interface ByteIterable
Specified by:
iterator in interface ByteList
Specified by:
iterator in interface Iterable<Byte>
Specified by:
iterator in interface Collection<Byte>
Specified by:
iterator in interface List<Byte>
Overrides:
iterator in class AbstractByteList
Returns:
a type-specific iterator on the elements of this collection.

listIterator

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

Specified by:
listIterator in interface ByteList
Specified by:
listIterator in interface List<Byte>
Overrides:
listIterator in class AbstractByteList
See Also:
List.listIterator(int)

subList

public ByteList subList(int from,
                        int to)
Description copied from interface: ByteList
Returns a type-specific view of the portion of this list from the index from, inclusive, to the index to, exclusive.

Note that this specification strengthens the one given in List.subList(int,int).

Specified by:
subList in interface ByteList
Specified by:
subList in interface List<Byte>
Overrides:
subList in class AbstractByteList
See Also:
List.subList(int,int)

size

public int size()
Specified by:
size in interface Collection<Byte>
Specified by:
size in interface List<Byte>
Specified by:
size in class AbstractCollection<Byte>

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
Parameters:
size - the new size.

clear

public void clear()
Specified by:
clear in interface Collection<Byte>
Specified by:
clear in interface List<Byte>
Overrides:
clear in class AbstractCollection<Byte>

clone

public Object clone()
Overrides:
clone in class Object

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
See Also:
Collection.remove(Object)

addAll

public boolean addAll(ByteCollection c)
Description copied from class: AbstractByteCollection
Adds all elements of the given type-specific collection to this collection.

Specified by:
addAll in interface ByteCollection
Overrides:
addAll in class AbstractByteList
Parameters:
c - a type-specific collection.
Returns:
true if this collection changed as a result of the call.
See Also:
Collection.addAll(Collection)

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
See Also:
List.add(int,Object)


Copyright © 2011. All Rights Reserved.