Sobes.tech
Intern — Middle

Finding a user in the list by name

livecode

Task condition

It is necessary to write a function that scans a list of user objects and returns the one whose name matches the given parameter.

class Person {
    String fullName;
    int age;
}
Optional<Person> findByName(List<Person> persons, String targetName)