Package gnu.trove.decorator
Class TIntListDecorator
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<java.lang.Integer>
-
- gnu.trove.decorator.TIntListDecorator
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<java.lang.Integer>
,java.util.Collection<java.lang.Integer>
,java.util.List<java.lang.Integer>
public class TIntListDecorator extends java.util.AbstractList<java.lang.Integer> implements java.util.List<java.lang.Integer>, java.io.Externalizable, java.lang.Cloneable
Wrapper class to make a TIntList conform to the java.util.List API. This class simply decorates an underlying TIntList and translates the Object-based APIs into their Trove primitive analogs. Note that wrapping and unwrapping primitive values is extremely inefficient. If possible, users of this class should override the appropriate methods in this class and use a table of canonical values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TIntListDecorator()
FOR EXTERNALIZATION ONLY!!TIntListDecorator(TIntList list)
Creates a wrapper that decorates the specified primitive map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, java.lang.Integer value)
java.lang.Integer
get(int index)
TIntList
getList()
Returns a reference to the list wrapped by this decorator.void
readExternal(java.io.ObjectInput in)
java.lang.Integer
remove(int index)
java.lang.Integer
set(int index, java.lang.Integer value)
int
size()
void
writeExternal(java.io.ObjectOutput out)
-
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
-
-
-
Field Detail
-
list
protected TIntList list
the wrapped primitive list
-
-
Constructor Detail
-
TIntListDecorator
public TIntListDecorator()
FOR EXTERNALIZATION ONLY!!
-
TIntListDecorator
public TIntListDecorator(TIntList list)
Creates a wrapper that decorates the specified primitive map.- Parameters:
list
- the TIntList to wrap.
-
-
Method Detail
-
getList
public TIntList getList()
Returns a reference to the list wrapped by this decorator.- Returns:
- the wrapped TIntList instance.
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<java.lang.Integer>
- Specified by:
size
in interfacejava.util.List<java.lang.Integer>
- Specified by:
size
in classjava.util.AbstractCollection<java.lang.Integer>
-
get
public java.lang.Integer get(int index)
- Specified by:
get
in interfacejava.util.List<java.lang.Integer>
- Specified by:
get
in classjava.util.AbstractList<java.lang.Integer>
-
set
public java.lang.Integer set(int index, java.lang.Integer value)
- Specified by:
set
in interfacejava.util.List<java.lang.Integer>
- Overrides:
set
in classjava.util.AbstractList<java.lang.Integer>
-
add
public void add(int index, java.lang.Integer value)
- Specified by:
add
in interfacejava.util.List<java.lang.Integer>
- Overrides:
add
in classjava.util.AbstractList<java.lang.Integer>
-
remove
public java.lang.Integer remove(int index)
- Specified by:
remove
in interfacejava.util.List<java.lang.Integer>
- Overrides:
remove
in classjava.util.AbstractList<java.lang.Integer>
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Specified by:
readExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
-
-