/** * Compares the specified Object with the receiver. * Returns true if and only if the specified Object is also an ArrayList of the same type, both Lists have the * same size, and all corresponding pairs of elements in the two Lists are identical. * In other words, two Lists are defined to be equal if they contain the * same elements in the same order. * * @param otherObj the Object to be compared for equality with the receiver. * @return true if the specified Object is equal to the receiver. */ public boolean equals(Object otherObj) { //delta // overridden for performance only. if (! (otherObj instanceof IntArrayList)) return super.equals(otherObj); if (this==otherObj) return true; if (otherObj==null) return false; IntArrayList other = (IntArrayList) otherObj; if (size()!=other.size()) return false; int[] theElements = elements(); int[] otherElements = other.elements(); for (int i=size(); --i >= 0; ) { if (theElements[i] != otherElements[i]) return false; } return true; } /**
/** * Compares the specified Object with the receiver. * Returns true if and only if the specified Object is also an ArrayList of the same type, both Lists have the * same size, and all corresponding pairs of elements in the two Lists are identical. * In other words, two Lists are defined to be equal if they contain the * same elements in the same order. * * @param otherObj the Object to be compared for equality with the receiver. * @return true if the specified Object is equal to the receiver. */ public boolean equals(Object otherObj) { //delta // overridden for performance only. if (! (otherObj instanceof IntArrayList)) return super.equals(otherObj); if (this==otherObj) return true; if (otherObj==null) return false; IntArrayList other = (IntArrayList) otherObj; if (size()!=other.size()) return false; int[] theElements = elements(); int[] otherElements = other.elements(); for (int i=size(); --i >= 0; ) { if (theElements[i] != otherElements[i]) return false; } return true; } /**
/** * Compares the specified Object with the receiver. Returns true if and only * if the specified Object is also an ArrayList of the same type, both Lists * have the same size, and all corresponding pairs of elements in the two * Lists are identical. In other words, two Lists are defined to be equal if * they contain the same elements in the same order. * * @param otherObj * the Object to be compared for equality with the receiver. * @return true if the specified Object is equal to the receiver. */ public boolean equals(Object otherObj) { // delta // overridden for performance only. if (!(otherObj instanceof IntArrayList)) return super.equals(otherObj); if (this == otherObj) return true; if (otherObj == null) return false; IntArrayList other = (IntArrayList) otherObj; if (size() != other.size()) return false; int[] theElements = elements(); int[] otherElements = other.elements(); for (int i = size(); --i >= 0;) { if (theElements[i] != otherElements[i]) return false; } return true; }