Class LongListAdapter
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
cern.colt.list.adapter.LongListAdapter
- All Implemented Interfaces:
Iterable, Collection, List, SequencedCollection
Adapter that permits an
AbstractLongList to be viewed and treated as a JDK 1.2 AbstractList.
Makes the contained list compatible with the JDK 1.2 Collections Framework.
Any attempt to pass elements other than java.lang.Number to setter methods will throw a java.lang.ClassCastException. java.lang.Number.longValue() is used to convert objects into primitive values which are then stored in the backing templated list. Getter methods return java.lang.Long objects.
-
Field Summary
FieldsFields inherited from class AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionLongListAdapter(AbstractLongList content) Constructs a list backed by the specified content list. -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts the specified element at the specified position in this list (optional operation).get(int index) Returns the element at the specified position in this list.protected static Objectobject(long element) Transforms an element of a primitive data type to an object.remove(int index) Removes the element at the specified position in this list (optional operation).Replaces the element at the specified position in this list with the specified element (optional operation).intsize()Returns the number of elements in this list.protected static longTransforms an object element to a primitive data type.Methods inherited from class AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subListMethods inherited from class AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from interface Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface List
add, addAll, addAll, addFirst, addLast, clear, contains, containsAll, equals, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, removeFirst, removeLast, replaceAll, retainAll, reversed, sort, spliterator, subList, toArray, toArray
-
Field Details
-
-
Constructor Details
-
LongListAdapter
Constructs a list backed by the specified content list.
-
-
Method Details
-
add
Inserts the specified element at the specified position in this list (optional operation). Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).- Specified by:
addin interfaceList- Overrides:
addin classAbstractList- Parameters:
index- index at which the specified element is to be inserted.element- element to be inserted.- Throws:
ClassCastException- if the class of the specified element prevents it from being added to this list.IllegalArgumentException- if some aspect of the specified element prevents it from being added to this list.IndexOutOfBoundsException- index is out of range (index < 0 || index > size()).
-
get
Returns the element at the specified position in this list.- Specified by:
getin interfaceList- Specified by:
getin classAbstractList- Parameters:
index- index of element to return.- Returns:
- the element at the specified position in this list.
- Throws:
IndexOutOfBoundsException- if the given index is out of range (index < 0 || index >= size()).
-
object
Transforms an element of a primitive data type to an object. -
remove
Removes the element at the specified position in this list (optional operation). Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.- Specified by:
removein interfaceList- Overrides:
removein classAbstractList- Parameters:
index- the index of the element to remove.- Returns:
- the element previously at the specified position.
- Throws:
IndexOutOfBoundsException- if the specified index is out of range (index < 0 || index >= size()).
-
set
Replaces the element at the specified position in this list with the specified element (optional operation).- Specified by:
setin interfaceList- Overrides:
setin classAbstractList- Parameters:
index- index of element to replace.element- element to be stored at the specified position.- Returns:
- the element previously at the specified position.
- Throws:
ClassCastException- if the class of the specified element prevents it from being added to this list.IllegalArgumentException- if some aspect of the specified element prevents it from being added to this list.IndexOutOfBoundsException- if the specified index is out of range (index < 0 || index >= size()).
-
size
public int size()Returns the number of elements in this list.- Specified by:
sizein interfaceCollection- Specified by:
sizein interfaceList- Specified by:
sizein classAbstractCollection- Returns:
- the number of elements in this list.
-
value
Transforms an object element to a primitive data type.
-