The replaceAll method replaces all elements of the current ArrayList instance with the result of the UnaryOperator expression (say what??? - I'll explain). This method may not produce the results that you think it should as this method replaces each and every element with the result of an expression. There is another replaceAll method in the Collections class where you can replace certain elements with other values - I'll demonstrate that as well. In order to use this method, you will need to have a basic understanding of lambda expressions. If you are not familiar with lambda expressions, the following tutorials will teach you what you need to know in order to use this method:
Lambda Expressions Introduction
Lambda Block Body
Lambda and Generic Functional Interface
The UnaryOperator interface is a functional interface that has a single abstract method named apply that returns a result of the same object type as the operand. The UnaryOperator interface does not have an explicitly defined abstract method, rather it inherits the abstract method apply from it's superinterface, Function.
On this page of the site you can watch the video online Learn Java Programming - ArrayList replaceAll Method Tutorial with a duration of hours minute second in good quality, which was uploaded by the user Daniel Ross 09 November 2015, share the link with friends and acquaintances, this video has already been watched 1,252 times on youtube and it was liked by 10 viewers. Enjoy your viewing!