org.apache.mahout.cf.taste.impl.common
Class LongPrimitiveArrayIterator
java.lang.Object
org.apache.mahout.cf.taste.impl.common.LongPrimitiveArrayIterator
- All Implemented Interfaces:
- Iterator<Long>, LongPrimitiveIterator, SkippingIterator<Long>
public final class LongPrimitiveArrayIterator
- extends Object
- implements LongPrimitiveIterator
While long[] is an Iterable, it is not an Iterable<Long>. This adapter class addresses that.
LongPrimitiveArrayIterator
public LongPrimitiveArrayIterator(long[] array)
Creates an LongPrimitiveArrayIterator
over an entire array.
- Parameters:
array
- array to iterate over
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface Iterator<Long>
next
public Long next()
- Specified by:
next
in interface Iterator<Long>
nextLong
public long nextLong()
- Specified by:
nextLong
in interface LongPrimitiveIterator
- Returns:
- next
long
in iteration
peek
public long peek()
- Specified by:
peek
in interface LongPrimitiveIterator
- Returns:
- next
long
in iteration without advancing iteration
remove
public void remove()
- Specified by:
remove
in interface Iterator<Long>
- Throws:
UnsupportedOperationException
skip
public void skip(int n)
- Description copied from interface:
SkippingIterator
- Skip the next n elements supplied by this
Iterator
. If there are less than n elements remaining,
this skips all remaining elements in the Iterator
. This method has the same effect as calling
Iterator.next()
n times, except that it will never throw NoSuchElementException
.
- Specified by:
skip
in interface SkippingIterator<Long>
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.