Package com.almworks.integers

Examples of com.almworks.integers.LongList


  }

  public long[] toArray(int sourceOffset, long[] dest, int destOffset, int length) {
    int slices = mySlices.size();
    for (int i = 0; i < slices && length > 0; i++) {
      LongList 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++) {
      LongList list = mySlices.get(i);
      size += list.size();
    }
    return size;
  }
View Full Code Here

  public long get(int index) {
    // Rewrite iterator(int, int) before replacing FOR with FOR-EACH
    //noinspection ForLoopReplaceableByForEach
    for (int i = 0; i < mySlices.size(); i++) {
      LongList 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 LongList concatUnmodifiable(LongList... lists) {
    if (lists == null || lists.length == 0)
      return EMPTY;
    int count = 0;
    LongList lastNonEmpty = null;
    for (LongList col : lists) {
      if (!col.isEmpty()) {
        count++;
        lastNonEmpty = col;
      }
View Full Code Here

TOP

Related Classes of com.almworks.integers.LongList

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.