Java Code Examples for it.unimi.dsi.fastutil.ints.IntIterators#fromTo()

The following examples show how to use it.unimi.dsi.fastutil.ints.IntIterators#fromTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PermutedFrontCodedStringList.java    From database with GNU General Public License v2.0 5 votes vote down vote up
public ObjectListIterator<CharSequence> listIterator( final int k ) { return new AbstractObjectListIterator<CharSequence>() {
		final IntListIterator i = IntIterators.fromTo( 0, frontCodedStringList.size() );
		
		public boolean hasNext() { return i.hasNext(); }
		public boolean hasPrevious() { return i.hasPrevious(); }
		public CharSequence next() { return frontCodedStringList.get( permutation[ i.nextInt() ] ); }
		public CharSequence previous() { return frontCodedStringList.get( permutation[ i.previousInt() ] ); }
		public int nextIndex() { return i.nextIndex(); }
		public int previousIndex() { return i.previousIndex(); }
	};
}
 
Example 2
Source File: Interval.java    From database with GNU General Public License v2.0 5 votes vote down vote up
/** Returns an iterator over the integers in this interval larger than or equal to a given integer. 
 *
 * @param from the starting integer.
 * @return an integer iterator over the elements in this interval.
 */
public IntBidirectionalIterator iterator( final int from ) {
	if ( this == EMPTY_INTERVAL ) return IntIterators.EMPTY_ITERATOR;
	// Note that fromTo() does NOT include the last integer.
	final IntBidirectionalIterator i = IntIterators.fromTo( left, right + 1 );
	if ( from > left ) i.skip( Math.min( length(), from - left ) );
	return i;
}
 
Example 3
Source File: InMemoryHashAggregationBuilder.java    From presto with Apache License 2.0 4 votes vote down vote up
private IntIterator consecutiveGroupIds()
{
    return IntIterators.fromTo(0, groupByHash.getGroupCount());
}
 
Example 4
Source File: Interval.java    From database with GNU General Public License v2.0 4 votes vote down vote up
/** Returns an iterator over the integers in this interval. 
 * 
 * @return an integer iterator over the elements in this interval.
 */
public IntBidirectionalIterator iterator() {
	if ( this == EMPTY_INTERVAL ) return IntIterators.EMPTY_ITERATOR;
	// Note that fromTo() does NOT include the last integer.
	return IntIterators.fromTo( left, right + 1 );
}