/** * Compares this big list to another object. If the argument is a {@link BigList}, this method * performs a lexicographical comparison; otherwise, it throws a <code>ClassCastException</code>. * * @param l a big list. * @return if the argument is a {@link BigList}, a negative integer, zero, or a positive integer * as this list is lexicographically less than, equal to, or greater than the argument. * @throws ClassCastException if the argument is not a big list. */ @SuppressWarnings("unchecked") public int compareTo(final BigList<? extends Float> l) { if (l == this) return 0; if (l instanceof FloatBigList) { final FloatBigListIterator i1 = listIterator(), i2 = ((FloatBigList) l).listIterator(); int r; float e1, e2; while (i1.hasNext() && i2.hasNext()) { e1 = i1.nextFloat(); e2 = i2.nextFloat(); if ((r = ((e1) < (e2) ? -1 : ((e1) == (e2) ? 0 : 1))) != 0) return r; } return i2.hasNext() ? -1 : (i1.hasNext() ? 1 : 0); } BigListIterator<? extends Float> i1 = listIterator(), i2 = l.listIterator(); int r; while (i1.hasNext() && i2.hasNext()) { if ((r = ((Comparable<? super Float>) i1.next()).compareTo(i2.next())) != 0) return r; } return i2.hasNext() ? -1 : (i1.hasNext() ? 1 : 0); }
@SuppressWarnings("unchecked") public boolean equals(final Object o) { if (o == this) return true; if (!(o instanceof BigList)) return false; final BigList<?> l = (BigList<?>) o; long s = size64(); if (s != l.size64()) return false; final BigListIterator<?> i1 = listIterator(), i2 = l.listIterator(); while (s-- != 0) if (!valEquals(i1.next(), i2.next())) return false; return true; }