com.hazelcast.util
Class IterableUtil

java.lang.Object
  extended by com.hazelcast.util.IterableUtil

public final class IterableUtil
extends Object

Utility functions for working with Iterable


Method Summary
static
<T> T
getFirst(Iterable<T> iterable, T defaultValue)
           
static
<T,R> Iterator<R>
limit(Iterator<R> iterator, int limit)
           
static
<T,R> Iterable<R>
map(Iterable<T> iterable, IFunction<T,R> mapper)
          Transform the Iterable by applying a function to each element
static
<T,R> Iterator<R>
map(Iterator<T> iterator, IFunction<T,R> mapper)
          Transform the Iterator by applying a function to each element
static
<T> Iterable<T>
nullToEmpty(Iterable<T> iterable)
          Return empty Iterable if argument is null
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getFirst

public static <T> T getFirst(Iterable<T> iterable,
                             T defaultValue)
Returns:
First element or defaultValue if iterable is empty

map

public static <T,R> Iterable<R> map(Iterable<T> iterable,
                                    IFunction<T,R> mapper)
Transform the Iterable by applying a function to each element


map

public static <T,R> Iterator<R> map(Iterator<T> iterator,
                                    IFunction<T,R> mapper)
Transform the Iterator by applying a function to each element


limit

public static <T,R> Iterator<R> limit(Iterator<R> iterator,
                                      int limit)

nullToEmpty

public static <T> Iterable<T> nullToEmpty(Iterable<T> iterable)
Return empty Iterable if argument is null



Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.