Skip to content

Latest commit

 

History

History
53 lines (45 loc) · 1.33 KB

File metadata and controls

53 lines (45 loc) · 1.33 KB

Buscar por dados

Objetivo
Search for data by using methods, such as findFirst(), findAny(), anyMatch(), allMatch(), and noneMatch()
-
Buscar por dados utilizando métodos, como findFirst(), findAny(), anyMatch(), allMatch(), e noneMatch()
  1. É possível recuperar o primeiro ou um elemento qualquer da coleção.

    src/org/j6toj8/collections/datasearch/DataSearch_FindFirstAny.java
    link:../../../src/org/j6toj8/collections/datasearch/DataSearch_FindFirstAny.java[role=include]
    Saída no console
    First: 1
    Any: 9
  2. É possível verificar se os elementos da coleção atendem ou não a algum critério.

    src/org/j6toj8/collections/datasearch/DataSearch_Match.java
    link:../../../src/org/j6toj8/collections/datasearch/DataSearch_Match.java[role=include]
    Saída no console
    anyMatch: true
    allMatch: false
    noneMatch: false
Referências
  • Using Streams

    Boyarsky, Jeanne; Selikoff, Scott. OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide (p. 185). Wiley. Edição do Kindle.

  • The Java 8 Stream API Tutorial.