The forEachRemaining() method is introduced in java 8 itself. This method makes iteration on iterator very easy. Basically, this method uses a lambda expression and reduces a lot of unnecessary code. Check below example,
No comments:
Post a Comment