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.RandomAccessByteList Detail: |
public boolean add(byte element) {
add(size(),element);
return true;
}
|
public void add(int index,
byte element) {
throw new UnsupportedOperationException();
}
Unsupported in this implementation. |
public boolean addAll(int index,
ByteCollection collection) {
boolean modified = false;
for(ByteIterator 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 ByteList) {
ByteList thatList = (ByteList)that;
if(size() != thatList.size()) {
return false;
}
for(ByteIterator thatIter = thatList.iterator(), thisIter = iterator(); thisIter.hasNext();) {
if(thisIter.next() != thatIter.next()) {
return false;
}
}
return true;
} else {
return false;
}
}
|
abstract public byte get(int index)
|
protected int getModCount() {
return _modCount;
}
Get my count of structural modifications. |
public int hashCode() {
int hash = 1;
for(ByteIterator iter = iterator(); iter.hasNext(); ) {
hash = 31*hash + ((int)(iter.next()));
}
return hash;
}
|
protected void incrModCount() {
_modCount++;
}
Increment my count of structural modifications. |
public int indexOf(byte element) {
int i = 0;
for(ByteIterator iter = iterator(); iter.hasNext(); ) {
if(iter.next() == element) {
return i;
} else {
i++;
}
}
return -1;
}
|
public ByteIterator iterator() {
return listIterator();
}
|
public int lastIndexOf(byte element) {
for(ByteListIterator iter = listIterator(size()); iter.hasPrevious(); ) {
if(iter.previous() == element) {
return iter.nextIndex();
}
}
return -1;
}
|
public ByteListIterator listIterator() {
return listIterator(0);
}
|
public ByteListIterator listIterator(int index) {
return new RandomAccessByteListIterator(this,index);
}
|
public byte removeElementAt(int index) {
throw new UnsupportedOperationException();
}
Unsupported in this implementation. |
public byte set(int index,
byte element) {
throw new UnsupportedOperationException();
}
Unsupported in this implementation. |
abstract public int size()
|
public ByteList subList(int fromIndex,
int toIndex) {
return new RandomAccessByteSubList(this,fromIndex,toIndex);
}
|
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("[");
for(ByteIterator iter = iterator(); iter.hasNext();) {
buf.append(iter.next());
if(iter.hasNext()) {
buf.append(", ");
}
}
buf.append("]");
return buf.toString();
}
|