java stream find specific element
Customer james = customers.stream()
.filter(customer -> "James".equals(customer.getName()))
.findAny()
.orElse(null);
java stream find specific element
Customer james = customers.stream()
.filter(customer -> "James".equals(customer.getName()))
.findAny()
.orElse(null);
how to select a element in an arraylist java
import java.util.ArrayList;
import java.util.Arrays;
public class ArrayListExample
{
public static void main(String[] args)
{
ArrayList<String> list = new ArrayList<>(Arrays.asList("alex", "brian", "charles", "dough"));
String firstName = list.get(0); //alex
String secondName = list.get(1); //brian
System.out.println(firstName);
System.out.println(secondName);
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us