So i normally do for example. Code:java Collection<HashSet<Block>> blockSets = chunkSplitter.values(); I would do something like Code:java for (HashSet<Block> : blockSets){ // Do something with the hashset.} But i recently came aware of .foreach() Code:java blockSets.forEach(blocks -> { // Do something with the hashset}); What is the difference?
@JanTuck There really is no difference, one is a for loop, one is a lambda expression (new in Java 8).
@JanTuck Well one also does streaming and uses Java 8 only features. It can also use implicit parallelization.
@JanTuck If you are supporting servers on Java 7, the regular for loop, if you are mainly for Java 8 you can use the forEach it does in my opinion also look nicer and can take a lot less code.