All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.psjava.util.IterableEqualityTester Maven / Gradle / Ivy

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