Java Spliterator forEachRemaining() MethodThe forEachRemaining() method of Java Interface Spliterator is used to performs the given action for each remaining element sequentially in the current thread until all elements have been processed or the action throws an exception. SyntaxFollowing is the declaration of forEachRemaining() method- Parameter
ReturnThe forEachRemaining() method does not return anything. It only performs the given action for each remaining element. ExceptionsNullPointerException- This method has thrown an exception if the specified action is null. Compatibility VersionJava 1.8 and above Example 1Test it NowOutput: Skype Next Element Present? true Remaining Name Present in the List: Facebook Instagram Twitter Example 2Test it NowOutput: Elements Exist in arraylist : 100 -200 300 -400 500 Example 3Test it NowOutput: Elements os Array- 1 2 3 4
Next TopicJava Spliterator class
|