Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

how to find specific elements from a list in java

public Customer findUsingEnhancedForLoop(
  String name, List<Customer> customers) {

    for (Customer customer : customers) {
        if (customer.getName().equals(name)) {
            return customer;
        }
    }
    return null;
}
Source by www.baeldung.com #
 
PREVIOUS NEXT
Tagged: #find #specific #elements #list #java
ADD COMMENT
Topic
Name
1+7 =