Package com.almworks.integers

Examples of com.almworks.integers.IntList


  }

  public int[] toArray(int sourceOffset, int[] dest, int destOffset, int length) {
    int slices = mySlices.size();
    for (int i = 0; i < slices && length > 0; i++) {
      IntList list = mySlices.get(i);
      int size = list.size();
      if (sourceOffset >= size) {
        sourceOffset -= size;
      } else {
        int x = Math.min(size - sourceOffset, length);
        list.toArray(sourceOffset, dest, destOffset, x);
        destOffset += x;
        sourceOffset = 0;
        length -= x;
      }
    }
View Full Code Here


  public int size() {
    int size = 0;
    //noinspection ForLoopReplaceableByForEach
    for (int i = 0; i < mySlices.size(); i++) {
      IntList list = mySlices.get(i);
      size += list.size();
    }
    return size;
  }
View Full Code Here

  public int get(int index) {
    // Rewrite iterator(int, int) before replacing FOR with FOR-EACH
    //noinspection ForLoopReplaceableByForEach
    for (int i = 0; i < mySlices.size(); i++) {
      IntList list = mySlices.get(i);
      int size = list.size();
      if (size > index)
        return list.get(index);
      index -= size;
    }
    throw new IndexOutOfBoundsException();
  }
View Full Code Here

  public static IntList concatUnmodifiable(IntList... lists) {
    if (lists == null || lists.length == 0)
      return EMPTY;
    int count = 0;
    IntList lastNonEmpty = null;
    for (IntList col : lists) {
      if (!col.isEmpty()) {
        count++;
        lastNonEmpty = col;
      }
View Full Code Here

TOP

Related Classes of com.almworks.integers.IntList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.