I am learning the new java 8 features now, after 4 years exclusively in C# world, so lambdas are on top for me. I am now struggling to find an equivalent for C#\'s \"OfType\" me
You can create a Function containing the Stream pipeline, which reduces its invocation.
Function,List> ofSub = bl -> bl.stream() .filter(x -> x instanceof SpecificNode) .map(n -> (SpecificNode) n) .collect(Collectors.toList());
For instance:
for( SpecificNode s: ofSub.apply( myNodes ) ){ //... }