Java 8 stream for-loop
Im new to Java 8 Streams and would like to convert following code-block to Java 8's Stream way of doing the same thing. Edit : Updates the class-names to be less confusing. (Removed Foo, Bar, Baz...) ArrayList<PriceList> priceLists = new ArrayList<PriceList>(); // I'm casting to a type-safe List from getObjects() // -which is a function I dont have access to. Is there a nice // solution to embed this in the stream-syntax? List<PriceListGroup> distObjects = (List<PriceListGroup>) objects.get(1).getObjects(); for(PriceListGroup group : distObjects) { Set<Affiliate> affiliates = group