org.apache.mahout.cf.taste.impl.common
Class LongPrimitiveArrayIterator

java.lang.Object
  extended by 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.


Constructor Summary
LongPrimitiveArrayIterator(long[] array)
           Creates an LongPrimitiveArrayIterator over an entire array.
 
Method Summary
 boolean hasNext()
           
 Long next()
           
 long nextLong()
           
 long peek()
           
 void remove()
           
 void skip(int n)
          Skip the next n elements supplied by this Iterator.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongPrimitiveArrayIterator

public LongPrimitiveArrayIterator(long[] array)

Creates an LongPrimitiveArrayIterator over an entire array.

Parameters:
array - array to iterate over
Method Detail

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.