### Question:
FoldRight implements Function<Generator<T>, T>, BinaryFunction<Generator<T>, T, T> { public FoldRight(BinaryFunction<? super T, ? super T, ? extends T> function) { this.function = function; } FoldRight(BinaryFunction<? super T, ? super T, ? extends T> function); final T evaluate(Generator<T> obj); final T evaluate(Generator<T> left, T right); @Override final boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }### Answer:
@Test public void testFoldRight() { FoldRight<Object> foldRight = new FoldRight<Object>(new BinaryFunction<Object, Object, Object>() { public Object evaluate(Object left, Object right) { StringBuilder buf = left instanceof StringBuilder ? (StringBuilder) left : new StringBuilder().append(left); return buf.append(right); } }); assertEquals("0123456789", foldRight.evaluate(IteratorToGeneratorAdapter.adapt(list.iterator())).toString()); assertEquals("0123456789x", foldRight.evaluate(IteratorToGeneratorAdapter.adapt(list.iterator()), "x").toString()); assertEquals("x", foldRight.evaluate(IteratorToGeneratorAdapter.adapt(new ArrayList<Object>().iterator()), "x").toString()); }