Java Code Examples for java.util.Map.Entry.equals()

The following are Jave code examples for showing how to use equals() of the java.util.Map.Entry class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: java-kdtree   File: Tree.java   View Source Code Vote up 6 votes
@Override
public boolean equals(Object object) {
	if (object == this) return true;
	if (object != null && getClass() == object.getClass()) {
		Tree<?, ?> tree = (Tree<?, ?>) object;
		if (size == tree.size && dimensions == tree.dimensions) {
			IteratorImpl<K, V> i = iterator();
			IteratorImpl<?, ?> o = tree.iterator();
			while (i.hasNext() && o.hasNext()) {
				Entry<K, V> e = i.next();
				Entry<?, ?> other = o.next();
				if (!e.equals(other)) return false;
			}
			return true;
		}
	}
	return false;
}