-
Notifications
You must be signed in to change notification settings - Fork 547
Open
Description
Oi Camila!
No desafio 7 realizei esta implementação:
package stream_api;
import java.util.Arrays;
import java.util.List;
public class Desafio7 {
public static void main(String[] args) {
List<Integer> numeros = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 5, 4, 3);
System.out.println(numeros.stream().sorted().toList().get(numeros.size()-2));
}
}porém fiquei com dúvida se seria uma boa forma de obter o elemento pedido usando get(numeros.size()-2)).
cami-lakalkrop
Metadata
Metadata
Assignees
Labels
No labels