Here you can find the source of compareRanges(final Iterator
public static <E extends Comparable<E>> int compareRanges(final Iterator<E> i, final Iterator<E> j)
//package com.java2s; //License from project: Open Source License import java.util.Iterator; public class Main { public static <E extends Comparable<E>> int compareRanges(final Iterator<E> i, final Iterator<E> j) { while (i.hasNext() && j.hasNext()) { final E a = i.next(); final E b = j.next(); final int ret = a.compareTo(b); if (ret != 0) { return ret; }/*www .j a va 2 s . c o m*/ } if (i.hasNext()) { return 1; } if (j.hasNext()) { return -1; } return 0; } }