org.ujorm.core
Class UjoIterator<T>

java.lang.Object
  extended by org.ujorm.core.UjoIterator<T>
All Implemented Interfaces:
Closeable, Iterable<T>, Iterator<T>

public abstract class UjoIterator<T>
extends Object
implements Iterable<T>, Iterator<T>, Closeable

Ujo iterator have got some extended functions:


Constructor Summary
UjoIterator()
           
 
Method Summary
 void close()
          Close all resources, if any.
 long count()
          Returns a count of items or value -1 if the count is not known.
static
<T> UjoIterator<T>
getInstance(Collection<T> collection)
          Deprecated. Use the method {@link #of(java.util.Collection) rather
static
<T> UjoIterator<T>
getInstance(Iterator<T> iterator)
          Deprecated. Use the method of(java.util.Iterator) rather
static
<T extends OrmUjo>
UjoIterator<T>
getInstance(Query<T> query)
          Deprecated. Use the method {@link #of(org.ujorm.orm.Query) rather
abstract  boolean hasNext()
          Tests if this enumeration contains more elements.
 Iterator<T> iterator()
          Returns the same instance
abstract  T next()
          Returns the next element if exists.
static
<T> UjoIterator<T>
of(Collection<T> collection)
          Create an instance
static
<T> UjoIterator<T>
of(Iterator<T> iterator)
          Create an instance
static
<T extends OrmUjo>
UjoIterator<T>
of(Query<T> query)
          Create an instance
 void remove()
          Deprecated. The method is not implemented.
 boolean skip(int count)
          Skip some items by the parameter.
 List<T> toList()
          Copy items to a new List
 String toString()
          Returns a count of items.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UjoIterator

public UjoIterator()
Method Detail

hasNext

public abstract boolean hasNext()
Tests if this enumeration contains more elements.

Specified by:
hasNext in interface Iterator<T>

next

public abstract T next()
                throws NoSuchElementException
Returns the next element if exists.

Specified by:
next in interface Iterator<T>
Returns:
the next element
Throws:
NoSuchElementException - no more elements exist.

count

public long count()
Returns a count of items or value -1 if the count is not known.


iterator

public Iterator<T> iterator()
Returns the same instance

Specified by:
iterator in interface Iterable<T>

remove

public void remove()
Deprecated. The method is not implemented.

An unsupported method.

Specified by:
remove in interface Iterator<T>

skip

public boolean skip(int count)
Skip some items by the parameter.

Parameters:
count - A count of item to skip.
Returns:
Returns a true value if the skip count was no limited.

toList

public List<T> toList()
               throws IllegalStateException
Copy items to a new List

Throws:
IllegalStateException

close

public void close()
Close all resources, if any. You may call this method if a data source was not read until the end.

Specified by:
close in interface Closeable

toString

public String toString()
Returns a count of items.

Overrides:
toString in class Object

of

public static final <T> UjoIterator<T> of(Iterator<T> iterator)
Create an instance


of

public static final <T> UjoIterator<T> of(Collection<T> collection)
Create an instance


of

public static final <T extends OrmUjo> UjoIterator<T> of(Query<T> query)
Create an instance


getInstance

@Deprecated
public static final <T> UjoIterator<T> getInstance(Iterator<T> iterator)
Deprecated. Use the method of(java.util.Iterator) rather

Create an instance


getInstance

@Deprecated
public static final <T> UjoIterator<T> getInstance(Collection<T> collection)
Deprecated. Use the method {@link #of(java.util.Collection) rather

Create an instance


getInstance

@Deprecated
public static final <T extends OrmUjo> UjoIterator<T> getInstance(Query<T> query)
Deprecated. Use the method {@link #of(org.ujorm.orm.Query) rather

Create an instance



Copyright 2013, Pavel Ponec