title: Spring Boot - search for word in ArrayList and return it in GET
body: <p>I have an array list in my <strong>Service</strong> class:</p>
  
  <pre><code>@Service
  public class PeopleService {
  
      private List&lt;Person&gt; people = new ArrayList&lt;&gt;(Arrays.asList(  
  
          new Person("1", "John", "Smith"),
          new Person("2", "Peter", "andna"),
          new Person("3", "Fred", "Rieger")
                      )); 
  </code></pre>
  
  <p>And what i want to do is that i want to create a method which would search for a palindrome word in this List and ten return it via GET request.
  My <strong>Controller</strong> will hopefully be this one:</p>
  
  <pre><code>//GET palindrome
  @RequestMapping("/people")
  public List &lt;Person&gt; getPalindromePeople() 
  {
      return peopleService.getPalindromePeople(); 
  }
  </code></pre>
  
  <p>I know that for a palindrome search i should adapt this code (code is not mine, i need to modify it):</p>
  
  <pre><code>int i1 = 0;
  int i2 = word.length - 1;
  while (i2 &gt; i1) {
      if (word[i1] != word[i2]) {
          return false;
      }
      ++i1;
      --i2;
  }
  return true;
  </code></pre>
  
  <p>The problem is that i can't figure out how to adapt that code to search for palindrome words in my Array List, because it consists of 3 objects, and each of them has 3 parameters (id, name, surname). 
  Could anyone give me a little hint with this one? I appreciate.</p>