com.amazon.carbonado.cursor
Class EmptyCursor<S>

java.lang.Object
  extended by com.amazon.carbonado.cursor.EmptyCursor<S>
All Implemented Interfaces:
Cursor<S>

public class EmptyCursor<S>
extends Object
implements Cursor<S>

Special cursor implementation that is empty.

Author:
Brian S O'Neill
See Also:
SingletonCursor

Method Summary
 void close()
          Does nothing.
 int copyInto(Collection<? super S> c)
          Performs no copy and always returns 0.
 int copyInto(Collection<? super S> c, int limit)
          Performs no copy and always returns 0.
 boolean hasNext()
          Always returns false.
 S next()
          Always throws NoSuchElementException.
 int skipNext(int amount)
          Always returns 0.
static
<S> Cursor<S>
the()
          Returns the empty cursor instance.
 List<S> toList()
          Always returns an empty list.
 List<S> toList(int limit)
          Always returns an empty list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

the

public static <S> Cursor<S> the()
Returns the empty cursor instance.


close

public void close()
Does nothing.

Specified by:
close in interface Cursor<S>

hasNext

public boolean hasNext()
Always returns false.

Specified by:
hasNext in interface Cursor<S>

next

public S next()
Always throws NoSuchElementException.

Specified by:
next in interface Cursor<S>

skipNext

public int skipNext(int amount)
Always returns 0.

Specified by:
skipNext in interface Cursor<S>
Parameters:
amount - maximum amount of elements to skip
Returns:
actual amount skipped

copyInto

public int copyInto(Collection<? super S> c)
Performs no copy and always returns 0.

Specified by:
copyInto in interface Cursor<S>
Returns:
actual amount of results added

copyInto

public int copyInto(Collection<? super S> c,
                    int limit)
Performs no copy and always returns 0.

Specified by:
copyInto in interface Cursor<S>
limit - maximum amount of elements to copy
Returns:
actual amount of results added

toList

public List<S> toList()
Always returns an empty list.

Specified by:
toList in interface Cursor<S>
Returns:
a new modifiable list

toList

public List<S> toList(int limit)
Always returns an empty list.

Specified by:
toList in interface Cursor<S>
Parameters:
limit - maximum amount of elements to copy
Returns:
a new modifiable list


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.