org.ujoframework.core
Class UjoIterator<T>

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

public abstract class UjoIterator<T>
extends java.lang.Object
implements java.lang.Iterable<T>, java.util.Iterator<T>

Ujo iterator have got some extended functions:

Author:
Pavel Ponec

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(java.util.Collection<T> collection)
           
static
<T> UjoIterator<T>
getInstance(java.util.Iterator<T> iterator)
           
static
<T extends OrmUjo>
UjoIterator<T>
getInstance(Query<T> query)
           
abstract  boolean hasNext()
          Tests if this enumeration contains more elements.
 java.util.Iterator<T> iterator()
          Returns the same instance
abstract  T next()
          Returns the next element if exists.
 void remove()
          Deprecated. The method is not implemented.
 boolean skip(int count)
          Skip some items by the parameter.
 java.util.List<T> toList()
          Copy items to a new List
 java.lang.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 java.util.Iterator<T>

next

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

Specified by:
next in interface java.util.Iterator<T>
Returns:
the next element
Throws:
java.util.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 java.util.Iterator<T> iterator()
Returns the same instance

Specified by:
iterator in interface java.lang.Iterable<T>

remove

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

An unsupported method.

Specified by:
remove in interface java.util.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 java.util.List<T> toList()
                         throws java.lang.IllegalStateException
Copy items to a new List

Throws:
java.lang.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.


toString

public java.lang.String toString()
Returns a count of items.

Overrides:
toString in class java.lang.Object

getInstance

public static final <T> UjoIterator<T> getInstance(java.util.Iterator<T> iterator)

getInstance

public static final <T> UjoIterator<T> getInstance(java.util.Collection<T> collection)

getInstance

public static final <T extends OrmUjo> UjoIterator<T> getInstance(Query<T> query)


Copyright © 2010. All Rights Reserved.