org.hibernate.shards.util
Class Iterables

java.lang.Object
  extended by org.hibernate.shards.util.Iterables

public class Iterables
extends Object

Helper methods related to Iterables.

Author:
maxr@google.com (Max Ross)

Method Summary
static
<T> Iterable<T>
concat(Iterable<? extends Iterable<? extends T>> iterable)
           
static
<T> Iterable<T>
concat(Iterable<? extends T>... iterables)
           
static
<T> Iterable<T>
rotate(List<T> list, int distance)
          Provides a rotated view of a list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

concat

public static <T> Iterable<T> concat(Iterable<? extends T>... iterables)
Returns:
an Iterable that allows you to iterate over the contents of all the iterables passed in.

concat

public static <T> Iterable<T> concat(Iterable<? extends Iterable<? extends T>> iterable)
Returns:
an Iterable that allows you to iterate over the contents of all the iterables passed in.

rotate

public static <T> Iterable<T> rotate(List<T> list,
                                     int distance)
Provides a rotated view of a list. Differs from Collections.rotate(java.util.List, int) only in that it leaves the underlying list unchanged. Note that this is a "live" view of the list that will change as the list changes. However, the behavior of an Iterator constructed from a rotated view of the list is undefined if the list is changed after the Iterator is constructed.

Parameters:
list - the list to return a rotated view of.
distance - the distance to rotate the list. There are no constraints on this value; it may be zero, negative, or greater than list.size().
Returns:
a rotated view of the given list