Iterator is an interface that allows iteration over a sequence of objects.

 import java.util.Iterator;

 * Utility methods to help in Iterable interactions.
public final class IterableUtil {

    /** Compares two sequences of values and returns true if sequence members are equal and in the same order */
    public static <T> boolean sequenceEqual(Iterable<T> one, Iterable<T> two) {
        Iterator<T> iter1 = one.iterator();
        Iterator<T> iter2 = two.iterator();

        while (iter1.hasNext() && iter2.hasNext()) {
            if ( != {
                return false;
        return (!iter1.hasNext() && !iter2.hasNext());

NB/= More documentation coming soon.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *