com.mozafaq.extmergesort.ComparisionIterator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of external-mergesort Show documentation
Show all versions of external-mergesort Show documentation
External merge sort algorithm
package com.mozafaq.extmergesort;
import java.util.Comparator;
import java.util.Iterator;
/**
* @author Mozaffar Afaque
*/
public interface ComparisionIterator extends Iterator {
T current();
default int compareToCurrent(Comparator comparator, T other) {
T thisOne = current();
if (thisOne == null) {
return -1;
}
return comparator.compare(thisOne, other);
};
}