Learn Java Programming - ArrayList replaceAll Method Tutorial

Pubblicato il: 09 novembre 2015
sul canale di: 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.


In questa pagina del sito puoi guardare il video online Learn Java Programming - ArrayList replaceAll Method Tutorial della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Daniel Ross 09 novembre 2015, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,252 volte e gli è piaciuto 10 spettatori. Buona visione!