Copyright 2002 by aragost

com.aragost.util
Class Iterators

java.lang.Object
  |
  +--com.aragost.util.Iterators

public abstract class Iterators
extends java.lang.Object

A utility class with some methods related to Iterators.


Constructor Summary
Iterators()
           
 
Method Summary
static void addAll(java.util.Collection coll, java.lang.Object obj)
           
static java.util.Iterator breadthFirst(java.lang.Object root, AttributeAccessor attributes)
           
static java.util.Iterator breadthFirst(java.lang.Object root, java.lang.String propertyName)
           
static java.util.Iterator breadthFirst(java.lang.Object root, java.lang.String property1, java.lang.String property2)
           
static java.util.Iterator concat(java.util.Collection iterators)
           
static java.util.Iterator concat(java.lang.Object a, java.lang.Object b)
          Convert the specified arguments to Iterators with the convert method, and return an iterator that iterates over the concatenation of these Iterators.
static java.util.Iterator concat(java.lang.Object a, java.lang.Object b, java.lang.Object c)
          Convert the specified arguments to Iterators with the convert method, and return an iterator that iterates over the concatenation of these Iterators.
static java.util.Iterator convert(java.lang.Object obj)
          Convert the specified Object to an Iterator.
static java.util.Iterator depthFirst(java.lang.Object root, AttributeAccessor attributes)
           
static java.util.Iterator depthFirst(java.lang.Object root, java.lang.String propertyName)
           
static java.util.Iterator depthFirst(java.lang.Object root, java.lang.String property1, java.lang.String property2)
           
static java.util.Iterator depthFirstBottomUp(java.lang.Object root, AttributeAccessor attributes)
           
static java.util.Iterator depthFirstBottomUp(java.lang.Object root, java.lang.String property)
           
static java.util.Iterator depthFirstBottomUp(java.lang.Object root, java.lang.String property1, java.lang.String property2)
           
static java.util.Iterator empty()
          Return an empty Iterator.
static java.util.Iterator filter(java.util.Iterator iter, Predicate pred)
          Return an Iterator that Iterates over the specified Iterator but only returns the elements where the Predicate returns true.
static java.util.Iterator filterNulls(java.util.Iterator iter)
          Return an Iterator that iterates over the specified Iterator skippng null values.
static java.util.List sort(java.util.Iterator iter)
          Return a list with the elements from the specified iterator sorted
static java.util.List sort(java.util.Iterator iter, java.util.Comparator comp)
          Return a list with the elements from the specified iterator sorted
static java.util.Collection toCollection(java.lang.Object obj, java.lang.Class type)
          Convert the specified object to an Iterator, and return a Collection with the elements from the iterator.
static java.util.Iterator transform(java.util.Iterator iter, Transformer transformer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Iterators

public Iterators()
Method Detail

convert

public static java.util.Iterator convert(java.lang.Object obj)
Convert the specified Object to an Iterator. If it is an Iterator return the Object it self. If it is a Collection return an Iterator for the Collection. If it is an Enumeration return a Iterator that will use the Enumeration. If it is an Array, return an Iterator that iterates over the Array. If non of the above cases apply return an Iterator that only iterates over the specified Object.


toCollection

public static java.util.Collection toCollection(java.lang.Object obj,
                                                java.lang.Class type)
Convert the specified object to an Iterator, and return a Collection with the elements from the iterator. The type of Collection is determind by the type parameter.


addAll

public static void addAll(java.util.Collection coll,
                          java.lang.Object obj)

concat

public static java.util.Iterator concat(java.lang.Object a,
                                        java.lang.Object b)
Convert the specified arguments to Iterators with the convert method, and return an iterator that iterates over the concatenation of these Iterators.


concat

public static java.util.Iterator concat(java.lang.Object a,
                                        java.lang.Object b,
                                        java.lang.Object c)
Convert the specified arguments to Iterators with the convert method, and return an iterator that iterates over the concatenation of these Iterators.


concat

public static java.util.Iterator concat(java.util.Collection iterators)

empty

public static java.util.Iterator empty()
Return an empty Iterator.


filterNulls

public static java.util.Iterator filterNulls(java.util.Iterator iter)
Return an Iterator that iterates over the specified Iterator skippng null values.


filter

public static java.util.Iterator filter(java.util.Iterator iter,
                                        Predicate pred)
Return an Iterator that Iterates over the specified Iterator but only returns the elements where the Predicate returns true.


transform

public static java.util.Iterator transform(java.util.Iterator iter,
                                           Transformer transformer)

depthFirst

public static java.util.Iterator depthFirst(java.lang.Object root,
                                            java.lang.String propertyName)

depthFirst

public static java.util.Iterator depthFirst(java.lang.Object root,
                                            java.lang.String property1,
                                            java.lang.String property2)

depthFirst

public static java.util.Iterator depthFirst(java.lang.Object root,
                                            AttributeAccessor attributes)

depthFirstBottomUp

public static java.util.Iterator depthFirstBottomUp(java.lang.Object root,
                                                    java.lang.String property)

depthFirstBottomUp

public static java.util.Iterator depthFirstBottomUp(java.lang.Object root,
                                                    java.lang.String property1,
                                                    java.lang.String property2)

depthFirstBottomUp

public static java.util.Iterator depthFirstBottomUp(java.lang.Object root,
                                                    AttributeAccessor attributes)

breadthFirst

public static java.util.Iterator breadthFirst(java.lang.Object root,
                                              java.lang.String propertyName)

breadthFirst

public static java.util.Iterator breadthFirst(java.lang.Object root,
                                              java.lang.String property1,
                                              java.lang.String property2)

breadthFirst

public static java.util.Iterator breadthFirst(java.lang.Object root,
                                              AttributeAccessor attributes)

sort

public static java.util.List sort(java.util.Iterator iter,
                                  java.util.Comparator comp)
Return a list with the elements from the specified iterator sorted


sort

public static java.util.List sort(java.util.Iterator iter)
Return a list with the elements from the specified iterator sorted


Copyright 2002 by aragost