abstract class A {} class B extends A {} class C extends A {} List items = // objects of B,C types items.stream.map(item -> build(item));