/** * Compares this list to another list, value by value. * * @param other the object to compare against * @return true if other is a LongArrayList and has exactly the same values. */ @Override public boolean equals(Object other) { if (other == this) { return true; } else if (other instanceof LongSequence) { LongSequence that = (LongSequence) other; if (that.size() != this.size()) { return false; } else { for (int i = pos; i-- > 0; ) { if (this.data[i] != that.data[i]) { return false; } } return true; } } else { return false; } }