public boolean hasDuplicates() { if (list.length < 2) return false; T prev = list[0]; for (int i = 1; i < list.length; i++) { if (compare(prev, list[i]) == 0) return true; prev = list[i]; } return false; }
public boolean hasDuplicates() { if (list.length < 2) return false; T prev = list[0]; for (int i = 1; i < list.length; i++) { if (compare(prev, list[i]) == 0) return true; prev = list[i]; } return false; }
/** * Find the first element that is equal or bigger than the given element * * @param toElement * @return absolute index (not relative!), returns end if not found */ private int find(Object toElement) { int i = start; for (; i < end; i++) { if (compare((T) toElement, list[i]) <= 0) break; } return i; }
public boolean hasDuplicates() { if (list.length < 2) return false; T prev = list[0]; for (int i = 1; i < list.length; i++) { if (compare(prev, list[i]) == 0) return true; prev = list[i]; } return false; }
@Override public boolean contains(Object o) { assert type == null || type.isInstance(o); for (int i = start; i < end; i++) { if (compare((T) o, list[i]) == 0) return true; } return false; }
@Override public boolean contains(Object o) { assert type == null || type.isInstance(o); for (int i = start; i < end; i++) { if (compare((T) o, list[i]) == 0) return true; } return false; }
@Override public boolean contains(Object o) { assert type == null || type.isInstance(o); for (int i = start; i < end; i++) { if (compare((T) o, list[i]) == 0) return true; } return false; }
@Override public int indexOf(Object o) { assert type == null || type.isInstance(o); int n = find(o); if (n < end && compare((T) o, list[n]) == 0) return n; return -1; }
@Override public int indexOf(Object o) { assert type == null || type.isInstance(o); int n = find(o); if (n < end && compare((T) o, list[n]) == 0) return n; return -1; }
@Override public int indexOf(Object o) { assert type == null || type.isInstance(o); int n = find(o); if (n < end && compare((T) o, list[n]) == 0) return n; return -1; }
@Override public int indexOf(Object o) { assert type == null || type.isInstance(o); int n = find(o); if (n < end && compare((T) o, list[n]) == 0) return n; return -1; }
@Override public int indexOf(Object o) { assert type == null || type.isInstance(o); int n = find(o); if (n < end && compare((T) o, list[n]) == 0) return n; return -1; }
public boolean isEqual(SortedList<T> list) { if (size() != list.size()) return false; for (int as = start, bs = list.start, al = size(); as < al && bs < al; as++, bs++) { if (compare(this.list[as], this.list[bs]) != 0) return false; } return true; }
public boolean isEqual(SortedList<T> list) { if (size() != list.size()) return false; for (int as = start, bs = list.start, al = size(); as < al && bs < al; as++, bs++) { if (compare(this.list[as], this.list[bs]) != 0) return false; } return true; }
public boolean isEqual(SortedList<T> list) { if (size() != list.size()) return false; for (int as = start, bs = list.start, al = size(); as < al && bs < al; as++, bs++) { if (compare(this.list[as], this.list[bs]) != 0) return false; } return true; }
public boolean isEqual(SortedList<T> list) { if (size() != list.size()) return false; for (int as = start, bs = list.start, al = size(); as < al && bs < al; as++, bs++) { if (compare(this.list[as], this.list[bs]) != 0) return false; } return true; }