private IntIterator consecutiveGroupIds() { return IntIterators.fromTo(0, groupByHash.getGroupCount()); }
public IntIterator positions() { return IntIterators.wrap( position ); }
/** * Unwraps an iterator, returning an array. * * <p> * This method iterates over the given type-specific iterator and returns an * array containing the elements returned by the iterator. * * @param i * a type-specific iterator. * @return an array containing the elements returned by the iterator. */ public static int[] unwrap(final IntIterator i) { return unwrap(i, Integer.MAX_VALUE); } /**
/** * Creates a new array list and fills it with a given collection. * * @param c * a collection that will be used to fill the array list. */ public IntArrayList(final Collection<? extends Integer> c) { this(c.size()); size = IntIterators.unwrap(IntIterators.asIntIterator(c.iterator()), a); } /**
/** * Creates a new hash set using elements provided by an iterator. * * @param i * an iterator whose elements will fill the set. * @param f * the load factor. */ public IntOpenHashSet(final Iterator<?> i, final float f) { this(IntIterators.asIntIterator(i), f); } /**
/** * Concatenates all iterators contained in an array. * * <p> * This method returns an iterator that will enumerate in order the elements * returned by all iterators contained in the given array. * * @param a * an array of iterators. * @return an iterator obtained by concatenation. */ public static IntIterator concat(final IntIterator a[]) { return concat(a, 0, a.length); } /**
public IntIterator positions() throws IOException { if ( ASSERTS ) ensureCurrentDocument(); if ( positionsUnread ) updatePositionCache(); return IntIterators.wrap( positionCache, 0, count ); }
/** * Unwraps an iterator into an array. * * <p> * This method iterates over the given type-specific iterator and stores the * elements returned in the given array. The iteration will stop when the * iterator has no more elements or when the end of the array has been reached. * * @param i * a type-specific iterator. * @param array * an array to contain the output of the iterator. * @return the number of elements unwrapped. */ public static int unwrap(final IntIterator i, final int array[]) { return unwrap(i, array, 0, array.length); } /**
/** * Creates a new hash set with {@link Hash#DEFAULT_LOAD_FACTOR} as load factor * using elements provided by an iterator. * * @param i * an iterator whose elements will fill the set. */ public IntLinkedOpenHashSet(final Iterator<?> i) { this(IntIterators.asIntIterator(i)); } /**
@Test(expected = IllegalArgumentException.class) public void testNegativeSkipArgument() { skip(IntIterators.fromTo(0, 10), -1); } }
public IntIterator positions() throws IOException { if ( ASSERTS ) ensureCurrentDocument(); if ( state <= BEFORE_POSITIONS ) updatePositionCache(); return IntIterators.wrap( positionCache, 0, count ); } public int[] positionArray() throws IOException {
public static boolean checkLength(final String resource, final int[] array, final String resouceFullPath) { final int actualLength = IntIterators.unwrap(BinIO.asIntIterator(new DataInputStream(InputBitStream.class.getResourceAsStream(resouceFullPath)))).length; assert array.length == actualLength : resource + " is long " + actualLength + " but we think it should rather be " + array.length; return true; }
/** * Creates a new tree set using elements provided by an iterator. * * @param i * an iterator whose elements will fill the set. */ public IntAVLTreeSet(final Iterator<?> i) { this(IntIterators.asIntIterator(i)); } /**
@Test public void testEstimateSelectivityOfBitmapList() { final int bitmapNum = 100; final List<ImmutableBitmap> bitmaps = Lists.newArrayListWithCapacity(bitmapNum); final BitmapIndex bitmapIndex = makeNonOverlappedBitmapIndexes(bitmapNum, bitmaps); final double estimated = Filters.estimateSelectivity( bitmapIndex, IntIteratorUtils.toIntList(IntIterators.fromTo(0, bitmapNum)), 10000 ); final double expected = 0.1; assertEquals(expected, estimated, 0.00001); }
public IntIterator positions() { ensurePositions(); return IntIterators.wrap( position ); }
/** * Creates a new array list and fills it with a given type-specific collection. * * @param c * a type-specific collection that will be used to fill the array * list. */ public IntArrayList(final IntCollection c) { this(c.size()); size = IntIterators.unwrap(c.iterator(), a); } /**
/** * Creates a new tree set using elements provided by an iterator. * * @param i * an iterator whose elements will fill the set. */ public IntRBTreeSet(final Iterator<?> i) { this(IntIterators.asIntIterator(i)); } /**
@Override public IntListIterator listIterator(int idx) { checkIndex(idx, startIndex, endIndex + 1); // this index can be one past the end return IntIterators.fromTo(startIndex + idx, endIndex); } }
public IntIterator positions() throws IOException { return IntIterators.wrap( positionArray(), 0, count ); }
@Override public int[] toArray(int a[]) { if (a == null || a.length < size()) a = new int[size()]; IntIterators.unwrap(iterator(), a); return a; } @Override