Learn Java Programming - ArrayList replaceAll Method Tutorial

Veröffentlicht am: 09 November 2015
auf dem Kanal: Daniel Ross
1,252
10

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.


Auf dieser Seite können Sie das Online-Video Learn Java Programming - ArrayList replaceAll Method Tutorial mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Daniel Ross 09 November 2015 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,252 Mal angesehen und es wurde von 10 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!