org.kuali.rice.core.util
Class CollectionUtils

java.lang.Object
  extended by org.kuali.rice.core.util.CollectionUtils

public class CollectionUtils
extends java.lang.Object

Yet another utility class to help work with Collections. This class contains helper methods not found in any of the Collection utilities rice currently uses.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Method Summary
static
<T> java.lang.Iterable<T>
toIterable(java.util.Enumeration<T> e)
          Creates an Iterable view of a Enumeration.
static
<T> java.lang.Iterable<T>
toIterable(java.util.Iterator<T> i)
          Creates an Iterable view of a Iterator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toIterable

public static <T> java.lang.Iterable<T> toIterable(java.util.Iterator<T> i)
Creates an Iterable view of a Iterator. This allows Iterators to be used in a foreach loop.
 Iterator<String> i ...
 
   for(String s : CollectionUtils.toIterable(i)) [
     System.out.println("i love for each " + s);	
   
 }
 

Type Parameters:
T - the type of the Iterable
Parameters:
i - the iterator to wrap
Returns:
the iterable

toIterable

public static <T> java.lang.Iterable<T> toIterable(java.util.Enumeration<T> e)
Creates an Iterable view of a Enumeration. This allows Enumerations to be used in a foreach loop.
 Enumeration<String> e ...
 
   for(String s : CollectionUtils.toIterable(e)) [
     System.out.println("i love for each " + s);	
   
 }
 

Type Parameters:
T - the type of the Iterable
Parameters:
e - the enumeration to wrap
Returns:
the iterable


Copyright © 2004-2011 The Kuali Foundation. All Rights Reserved.