@Test void testUpcastingResultOfOtherUpcaster() { Object a = "a", b = "b", c = "c"; Upcaster<Object> testSubject = new GenericUpcasterChain<>(new AToBUpcaster(a, b), new AToBUpcaster(b, c)); Stream<Object> result = testSubject.upcast(Stream.of(a, b, a, c)); assertEquals(Arrays.asList(c, c, c, c), result.collect(toList())); }
@Override public Stream<T> upcast(Stream<T> initialRepresentations) { Stream<T> result = initialRepresentations; for (Upcaster<T> upcaster : getUpcasters()) { result = upcaster.upcast(result); } return result; }
GenericUpcasterChain implements Upcaster<T> { @Override public Stream<T> upcast(Stream<T> initialRepresentations) { Stream<T> result = initialRepresentations; for (Upcaster<T> upcaster : getUpcasters()) { result = upcaster.upcast(result); } return result; } }
GenericUpcasterChain implements Upcaster<T> { @Override public Stream<T> upcast(Stream<T> initialRepresentations) { Stream<T> result = initialRepresentations; for (Upcaster<T> upcaster : getUpcasters()) { result = upcaster.upcast(result); } return result; } @SafeVarargs  GenericUpcasterChain(Upcaster<T>... upcasters);  GenericUpcasterChain(List<? extends Upcaster<T>> upcasters); }
GenericUpcasterChain implements Upcaster<T> { @Override public Stream<T> upcast(Stream<T> initialRepresentations) { Stream<T> result = initialRepresentations; for (Upcaster<T> upcaster : getUpcasters()) { result = upcaster.upcast(result); } return result; } @SafeVarargs  GenericUpcasterChain(Upcaster<T>... upcasters);  GenericUpcasterChain(List<? extends Upcaster<T>> upcasters); @Override Stream<T> upcast(Stream<T> initialRepresentations); }
GenericUpcasterChain implements Upcaster<T> { @Override public Stream<T> upcast(Stream<T> initialRepresentations) { Stream<T> result = initialRepresentations; for (Upcaster<T> upcaster : getUpcasters()) { result = upcaster.upcast(result); } return result; } @SafeVarargs  GenericUpcasterChain(Upcaster<T>... upcasters);  GenericUpcasterChain(List<? extends Upcaster<T>> upcasters); @Override Stream<T> upcast(Stream<T> initialRepresentations);  }