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(); }
public int hashCode() { int hash = 1; for (ByteIterator iter = iterator(); iter.hasNext(); ) { hash = 31 * hash + ((int) (iter.next())); } return hash; }
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 int indexOf(byte element) { int i = 0; for (ByteIterator iter = iterator(); iter.hasNext(); ) { if (iter.next() == element) { return i; } else { i++; } } return -1; }
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; } }