@Test public void testEquals() { SortedIntArray s1 = new SortedIntArray(1, 3, 7); SortedIntArray s2 = new SortedIntArray(3, 1, 7); SortedIntArray s3 = new SortedIntArray(1, 3); assertEquals(s1.hashCode(), s2.hashCode()); assertTrue(s1.equals(s2)); assertTrue(s2.equals(s1)); assertFalse(s1.equals(s3)); assertFalse(s3.equals(s1)); assertFalse(s1.hashCode() == s3.hashCode()); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) return false; if (getClass() != obj.getClass()) return false; SortedIntArray other = (SortedIntArray) obj; if (length != other.length) return false; for (int i = 0; i < length; i++) { if (a[i] != other.a[i]) return false; } return true; }
SortedIntArray implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) return false; if (getClass() != obj.getClass()) return false; SortedIntArray other = (SortedIntArray) obj; if (length != other.length) return false; for (int i = 0; i < length; i++) { if (a[i] != other.a[i]) return false; } return true; } }
SortedIntArray implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) return false; if (getClass() != obj.getClass()) return false; SortedIntArray other = (SortedIntArray) obj; if (length != other.length) return false; for (int i = 0; i < length; i++) { if (a[i] != other.a[i]) return false; } return true; } SortedIntArray();  SortedIntArray(int capacity);  SortedIntArray(int... array); }
SortedIntArray implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) return false; if (getClass() != obj.getClass()) return false; SortedIntArray other = (SortedIntArray) obj; if (length != other.length) return false; for (int i = 0; i < length; i++) { if (a[i] != other.a[i]) return false; } return true; } SortedIntArray();  SortedIntArray(int capacity);  SortedIntArray(int... array); int insert(int x); int search(int x); int get(int pos); boolean isEmpty(); int[] getArray(); int size(); PrimitiveIterator.OfInt getAscendingIterator(int startFrom); PrimitiveIterator.OfInt getDescendingIterator(int startFrom); void forEach(IntConsumer action); boolean contains(int x); static SortedIntArray decodeFromVarIntArray(byte[] buf); @Override boolean equals(Object obj); void add(int x); String toString(); @Override int hashCode(); }
SortedIntArray implements Serializable { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) return false; if (getClass() != obj.getClass()) return false; SortedIntArray other = (SortedIntArray) obj; if (length != other.length) return false; for (int i = 0; i < length; i++) { if (a[i] != other.a[i]) return false; } return true; } SortedIntArray();  SortedIntArray(int capacity);  SortedIntArray(int... array); int insert(int x); int search(int x); int get(int pos); boolean isEmpty(); int[] getArray(); int size(); PrimitiveIterator.OfInt getAscendingIterator(int startFrom); PrimitiveIterator.OfInt getDescendingIterator(int startFrom); void forEach(IntConsumer action); boolean contains(int x); static SortedIntArray decodeFromVarIntArray(byte[] buf); @Override boolean equals(Object obj); void add(int x); String toString(); @Override int hashCode(); static int DEFAULT_CAPACITY; }