org.psjava.util.IterableEqualityTester Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of psjava Show documentation
Show all versions of psjava Show documentation
Problem Solving Library for Java
The newest version!
package org.psjava.util;
import java.util.Iterator;
public class IterableEqualityTester {
public static boolean areEqual(Iterable o1, Iterable o2) {
Iterator iter1 = o1.iterator();
Iterator iter2 = o2.iterator();
while (true) {
if (iter1.hasNext() != iter2.hasNext())
return false;
if (!iter1.hasNext())
return true;
T v1 = iter1.next();
T v2 = iter2.next();
if (!v1.equals(v2))
return false;
}
}
private IterableEqualityTester() {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy