### Question:
TransformedIterator implements Iterator<T> { public static <E> Iterator<?> maybeTransform(Iterator<? extends E> iter, Function<? super E, ?> func) { return null == func ? (null == iter ? null : iter) : new TransformedIterator<E, Object>(iter, func); } 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 testTransformWithNullFunctionReturnsIdentity() { Iterator<Integer> iter = list.iterator(); assertSame(iter, TransformedIterator.maybeTransform(iter, null)); }
@Test public void testTransformWithNullIteratorAndNullFunctionReturnsNull() { assertSame(null, TransformedIterator.maybeTransform(null, null)); }