java – Spring Boot – search for word in ArrayList and return it in GET

java – Spring Boot – search for word in ArrayList and return it in GET

You need to iterate through the list and call call for palindrome check.
Here is a piece which checks for palindrome based on firstName

List<Person> persons;
List<Person> resultList = new ArrayList<>();
for(Person person: persons){
    if(istPalindrom((person.getFirstName().toCharArray())))
        resultList.add(person)
}
return resultList

Based on your logic you can add check on fistName and lastName or firstName or lastName by changing the if condition

java – Spring Boot – search for word in ArrayList and return it in GET

Leave a Reply

Your email address will not be published. Required fields are marked *