s backed
by random access structures like arrays.
. Mutable subclasses
should also override
. Variably-sized
subclasses should also override
. All other methods
have at least some base implementation derived from
these. Subclasses may choose to override these methods
to provide a more efficient implementation.
| Method from org.apache.commons.collections.primitives.RandomAccessDoubleList Detail: |
public boolean add(double element) {
add(size(),element);
return true;
}
|
public void add(int index,
double element) {
throw new UnsupportedOperationException();
}
Unsupported in this implementation. |
public boolean addAll(int index,
DoubleCollection collection) {
boolean modified = false;
for(DoubleIterator iter = collection.iterator(); iter.hasNext(); ) {
add(index++,iter.next());
modified = true;
}
return modified;
}
|
public boolean equals(Object that) {
if(this == that) {
return true;
} else if(that instanceof DoubleList) {
DoubleList thatList = (DoubleList)that;
if(size() != thatList.size()) {
return false;
}
for(DoubleIterator thatIter = thatList.iterator(), thisIter = iterator(); thisIter.hasNext();) {
if(thisIter.next() != thatIter.next()) {
return false;
}
}
return true;
} else {
return false;
}
}
|
abstract public double get(int index)
|
protected int getModCount() {
return _modCount;
}
Get my count of structural modifications. |
public int hashCode() {
int hash = 1;
for(DoubleIterator iter = iterator(); iter.hasNext(); ) {
long bits = Double.doubleToLongBits(iter.next());
hash = 31*hash + ((int)(bits ^ (bits > > > 32)));
}
return hash;
}
|
protected void incrModCount() {
_modCount++;
}
Increment my count of structural modifications. |
public int indexOf(double element) {
int i = 0;
for(DoubleIterator iter = iterator(); iter.hasNext(); ) {
if(iter.next() == element) {
return i;
} else {
i++;
}
}
return -1;
}
|
public DoubleIterator iterator() {
return listIterator();
}
|
public int lastIndexOf(double element) {
for(DoubleListIterator iter = listIterator(size()); iter.hasPrevious(); ) {
if(iter.previous() == element) {
return iter.nextIndex();
}
}
return -1;
}
|
public DoubleListIterator listIterator() {
return listIterator(0);
}
|
public DoubleListIterator listIterator(int index) {
return new RandomAccessDoubleListIterator(this,index);
}
|
public double removeElementAt(int index) {
throw new UnsupportedOperationException();
}
Unsupported in this implementation. |
public double set(int index,
double element) {
throw new UnsupportedOperationException();
}
Unsupported in this implementation. |
abstract public int size()
|
public DoubleList subList(int fromIndex,
int toIndex) {
return new RandomAccessDoubleSubList(this,fromIndex,toIndex);
}
|
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("[");
for(DoubleIterator iter = iterator(); iter.hasNext();) {
buf.append(iter.next());
if(iter.hasNext()) {
buf.append(", ");
}
}
buf.append("]");
return buf.toString();
}
|