/**
  * Copies element of this type-specific big list into the given big array one-by-one.
  *
  * <p>This is a trivial iterator-based implementation. It is expected that implementations will
  * override this method with a more optimized version.
  *
  * @param from the start index (inclusive).
  * @param a the destination big array.
  * @param offset the offset into the destination big array where to store the first element
  *     copied.
  * @param length the number of elements to be copied.
  */
 public void getElements(final long from, final float a[][], long offset, long length) {
   FloatBigListIterator i = listIterator(from);
   FloatBigArrays.ensureOffsetLength(a, offset, length);
   if (from + length > size64())
     throw new IndexOutOfBoundsException(
         "End index (" + (from + length) + ") is greater than list size (" + size64() + ")");
   while (length-- != 0) FloatBigArrays.set(a, offset++, i.nextFloat());
 }
 public long lastIndexOf(final float k) {
   FloatBigListIterator i = listIterator(size64());
   float e;
   while (i.hasPrevious()) {
     e = i.previousFloat();
     if (((k) == (e))) return i.nextIndex();
   }
   return -1;
 }
 public long indexOf(final float k) {
   final FloatBigListIterator i = listIterator();
   float e;
   while (i.hasNext()) {
     e = i.nextFloat();
     if (((k) == (e))) return i.previousIndex();
   }
   return -1;
 }
 /**
  * Removes elements of this type-specific big list one-by-one.
  *
  * <p>This is a trivial iterator-based implementation. It is expected that implementations will
  * override this method with a more optimized version.
  *
  * @param from the start index (inclusive).
  * @param to the end index (exclusive).
  */
 public void removeElements(final long from, final long to) {
   ensureIndex(to);
   FloatBigListIterator i = listIterator(from);
   long n = to - from;
   if (n < 0)
     throw new IllegalArgumentException(
         "Start index (" + from + ") is greater than end index (" + to + ")");
   while (n-- != 0) {
     i.nextFloat();
     i.remove();
   }
 }
  /**
   * 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);
  }