public class DoubleList
extends java.lang.Object
Constructor and Description |
---|
DoubleList()
create an DoubleList of default size
|
DoubleList(DoubleList list)
create a copy of an existing DoubleList
|
DoubleList(int initialCapacity)
create an DoubleList with a predefined initial size
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(double value)
Appends the specified element to the end of this list
|
void |
add(int index,
double value)
add the specfied value at the specified index
|
boolean |
addAll(DoubleList c)
Appends all of the elements in the specified collection to the
end of this list, in the order that they are returned by the
specified collection's iterator.
|
boolean |
addAll(int index,
DoubleList c)
Inserts all of the elements in the specified collection into
this list at the specified position.
|
void |
clear()
Removes all of the elements from this list.
|
boolean |
contains(double o)
Returns true if this list contains the specified element.
|
boolean |
containsAll(DoubleList c)
Returns true if this list contains all of the elements of the
specified collection.
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this list for equality.
|
double |
get(int index)
Returns the element at the specified position in this list.
|
int |
hashCode()
THIS MOST LIKELY DOES NOT WORK
Returns the hash code value for this list.
|
int |
indexOf(double o)
Returns the index in this list of the first occurrence of the
specified element, or -1 if this list does not contain this
element.
|
boolean |
isEmpty()
Returns true if this list contains no elements.
|
int |
lastIndexOf(double o)
Returns the index in this list of the last occurrence of the
specified element, or -1 if this list does not contain this
element.
|
double |
remove(int index)
Removes the element at the specified position in this list.
|
boolean |
removeAll(DoubleList c)
Removes from this list all the elements that are contained in
the specified collection
|
boolean |
removeValue(double o)
Removes the first occurrence in this list of the specified
element (optional operation).
|
boolean |
retainAll(DoubleList c)
Retains only the elements in this list that are contained in
the specified collection.
|
double |
set(int index,
double element)
Replaces the element at the specified position in this list
with the specified element
|
int |
size()
Returns the number of elements in this list.
|
double[] |
toArray()
Returns an array containing all of the elements in this list in
proper sequence.
|
double[] |
toArray(double[] a)
Returns an array containing all of the elements in this list in
proper sequence.
|
public DoubleList()
public DoubleList(DoubleList list)
list
- the existing DoubleListpublic DoubleList(int initialCapacity)
initialCapacity
- the size for the internal arraypublic void add(int index, double value)
index
- the index where the new value is to be addedvalue
- the new valuejava.lang.IndexOutOfBoundsException
- if the index is out of
range (index < 0 || index > size()).public boolean add(double value)
value
- element to be appended to this list.public boolean addAll(DoubleList c)
c
- collection whose elements are to be added to this
list.public boolean addAll(int index, DoubleList c)
index
- index at which to insert first element from the
specified collection.c
- elements to be inserted into this list.java.lang.IndexOutOfBoundsException
- if the index is out of
range (index < 0 || index > size())public void clear()
public boolean contains(double o)
o
- element whose presence in this list is to be tested.public boolean containsAll(DoubleList c)
c
- collection to be checked for containment in this list.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to be compared for equality with this list.public double get(int index)
index
- index of element to return.java.lang.IndexOutOfBoundsException
- if the index is out of
range (index < 0 || index >= size()).public int hashCode()
hashCode = 1;
Iterator i = list.iterator();
while (i.hasNext()) {
Object obj = i.next();
hashCode = 31*hashCode + (obj==null ? 0 : obj.hashCode());
}
This ensures that list1.equals(list2) implies that
list1.hashCode()==list2.hashCode() for any two lists, list1 and
list2, as required by the general contract of Object.hashCode.hashCode
in class java.lang.Object
public int indexOf(double o)
o
- element to search for.public boolean isEmpty()
public int lastIndexOf(double o)
o
- element to search for.public double remove(int index)
index
- the index of the element to removed.java.lang.IndexOutOfBoundsException
- if the index is out of
range (index < 0 || index >= size()).public boolean removeValue(double o)
o
- element to be removed from this list, if present.public boolean removeAll(DoubleList c)
c
- collection that defines which elements will be removed
from this list.public boolean retainAll(DoubleList c)
c
- collection that defines which elements this set will
retain.public double set(int index, double element)
index
- index of element to replace.element
- element to be stored at the specified position.java.lang.IndexOutOfBoundsException
- if the index is out of
range (index < 0 || index >= size()).public int size()
public double[] toArray()
public double[] toArray(double[] a)
a
- the array into which the elements of this list are to
be stored, if it is big enough; otherwise, a new array
is allocated for this purpose.Copyright © 2014 Open Microscopy Environment