org.aksw.commons.collections
Class CollectionUtils

java.lang.Object
  extended by org.aksw.commons.collections.CollectionUtils

public class CollectionUtils
extends Object

User: raven Date: 4/17/11 Time: 12:36 AM


Constructor Summary
CollectionUtils()
           
 
Method Summary
static
<T> Set<T>
asSet(Collection<T> c)
           
static
<T> List<List<T>>
chunk(Iterable<T> col, int batchSize)
           
static
<S,T extends Iterable<S>>
Iterable<S>
safeGetFirst(Iterable<T> iterable)
          Given an iterable A whose elements are iterables, this method will return the first element of A.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionUtils

public CollectionUtils()
Method Detail

safeGetFirst

public static <S,T extends Iterable<S>> Iterable<S> safeGetFirst(Iterable<T> iterable)
Given an iterable A whose elements are iterables, this method will return the first element of A. If no such element exist, an empty iterable is returned rather than null.

Type Parameters:
S -
T -
Parameters:
iterable -
Returns:

chunk

public static <T> List<List<T>> chunk(Iterable<T> col,
                                      int batchSize)

asSet

public static <T> Set<T> asSet(Collection<T> c)


Copyright © 2011. All Rights Reserved.