public class DoubleArrayList extends java.lang.Object implements DoubleList, java.util.RandomAccess
实现了所有可选列表操作。除了实现 FloatList 接口外,此类还提供一些方法来操作内部用来存储列表的数组的大小。
(此类大致上等同于 Java的List<Float>类)
| 构造器和说明 |
|---|
DoubleArrayList()
构建一个空的列表.
|
DoubleArrayList(int initialCapacity)
指定容量的方式构建一个IntList.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
add(double e)
Appends the specified element to the end of this list.
|
boolean |
addAll(double[] a)
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.
|
void |
clear()
Removes all of the elements from this list.
|
boolean |
contains(double o)
Returns true if this list contains the specified element.
|
boolean |
equals(java.lang.Object obj) |
double |
get(int index)
Returns the element at the specified position in this list.
|
int |
hashCode() |
int |
indexOf(double x)
返回此列表中第一次出现的指定元素的索引.
|
boolean |
isEmpty()
Returns true if this list contains no elements.
|
int |
lastIndexOf(double x)
返回此列表中最后出现的指定元素的索引.
|
double |
random()
从列表中随机出一个元素.
|
boolean |
remove(double o)
Removes the first occurrence of the specified element from this list, if
it is present.
|
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 (from first to last element).
|
void |
trimToSize()
将此IntArrayList实例的容量调整为列表的当前大小。
|
public DoubleArrayList()
public DoubleArrayList(int initialCapacity)
initialCapacity - 初始容量public void trimToSize()
应用程序可以使用此操作来最小化 IntArrayList实例的存储量。
public double random()
DoubleListrandom 在接口中 DoubleListpublic int size()
size 在接口中 DoubleListpublic boolean isEmpty()
isEmpty 在接口中 DoubleListpublic boolean contains(double o)
contains 在接口中 DoubleListo - element whose presence in this list is to be testedpublic int indexOf(double x)
如果列表不包含此元素,则返回 -1。
更确切地讲,返回满足 (get(i)==x) 的最高索引 i;
如果没有这样的索引,则返回 -1。
x - 要搜索的元素public int lastIndexOf(double x)
如果列表不包含此元素,则返回 -1。
更确切地讲,返回满足 (get(i)==x) 的最高索引 i;
如果没有这样的索引,则返回 -1。
x - 要搜索的元素public double[] toArray()
The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
toArray 在接口中 DoubleListpublic double get(int index)
get 在接口中 DoubleListindex - index of the element to returnjava.lang.IndexOutOfBoundsExceptionpublic boolean add(double e)
add 在接口中 DoubleListe - element to be appended to this listCollection.add(E))public boolean remove(double o)
remove 在接口中 DoubleListo - element to be removed from this list, if presentpublic void clear()
clear 在接口中 DoubleListpublic boolean addAll(double[] a)
a - collection containing elements to be added to this listjava.lang.NullPointerException - if the specified collection is nullpublic int hashCode()
hashCode 在类中 java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals 在类中 java.lang.Object