### Question:
TransformedIterator implements Iterator<T> { @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof TransformedIterator<?, ?>)) { return false; } TransformedIterator<?, ?> that = (TransformedIterator<?, ?>) obj; return function.equals(that.function) && iterator.equals(that.iterator); } TransformedIterator(Iterator<? extends E> iterator, Function<? super E, ? extends T> function); boolean hasNext(); T next(); void remove(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static Iterator<T> transform(Iterator<? extends E> iter, Function<? super E, ? extends T> func); static Iterator<?> maybeTransform(Iterator<? extends E> iter, Function<? super E, ?> func);  }### Answer:
@Test public void testEquals() { Iterator<Integer> iter = list.iterator(); TransformedIterator<Integer, Integer> t = new TransformedIterator<Integer, Integer>(iter, negate); Function<Number, Double> negateDouble = new Function<Number, Double>() { public Double evaluate(Number obj) { return Double.valueOf(obj.intValue() * -1); } }; assertEquals(t, new TransformedIterator<Integer, Integer>(iter, negate)); assertTrue(!t.equals(new TransformedIterator<Integer, Double>(list.iterator(), negateDouble))); assertTrue(!t.equals(new TransformedIterator<Float, Integer>(Arrays.asList(0.0f, 0.1f).iterator(), negate))); assertTrue(!t.equals(null)); }