public class DoubleListAdapter extends AbstractList implements List
AbstractDoubleList
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.doubleValue() is used to convert objects into primitive values which are then stored in the backing templated list. Getter methods return java.lang.Double objects.
Modifier and Type | Field and Description |
---|---|
protected AbstractDoubleList |
content |
modCount
Constructor and Description |
---|
DoubleListAdapter(AbstractDoubleList content)
Constructs a list backed by the specified content list.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
Object element)
Inserts the specified element at the specified position in this list
(optional operation).
|
Object |
get(int index)
Returns the element at the specified position in this list.
|
protected static Object |
object(double element)
Transforms an element of a primitive data type to an object.
|
Object |
remove(int index)
Removes the element at the specified position in this list (optional
operation).
|
Object |
set(int index,
Object element)
Replaces the element at the specified position in this list with the
specified element (optional operation).
|
int |
size()
Returns the number of elements in this list.
|
protected static double |
value(Object element)
Transforms an object element to a primitive data type.
|
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
protected AbstractDoubleList content
public DoubleListAdapter(AbstractDoubleList content)
public void add(int index, Object element)
add
in interface List
add
in class AbstractList
index
- index at which the specified element is to be inserted.element
- element to be inserted.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()).public Object get(int index)
get
in interface List
get
in class AbstractList
index
- index of element to return.IndexOutOfBoundsException
- if the given index is out of range
(index < 0 || index >= size()).protected static Object object(double element)
public Object remove(int index)
remove
in interface List
remove
in class AbstractList
index
- the index of the element to remove.IndexOutOfBoundsException
- if the specified index is out of
range (index < 0 || index >= size()).public Object set(int index, Object element)
set
in interface List
set
in class AbstractList
index
- index of element to replace.element
- element to be stored at the specified position.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()).public int size()
size
in interface Collection
size
in interface List
size
in class AbstractCollection
protected static double value(Object element)
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.