title: How to filter a Page in spring-boot while keeping paging?
body: <p>I get a Page from my database through JpaRepository and want to filter this page by name.</p>
  
  <p>This is my code:</p>
  
  <pre class="lang-java prettyprint-override"><code>// other code
  Pageable pageable = PageRequest.of(page,size);
  Page&lt;Entity&gt; foundEntities = entityRepository.findAll(pageable);
  
  final String compareString = "example";
  List&lt;Entity&gt; filteredEntities = foundEntities
      .stream()
      .filter(e -&gt; e.getName().toLowerCase().contains(compareString))
      .collect(Collectors.toList());
  foundEntities = new PageImpl&lt;&gt;(filteredEntities, pageable, filteredEntities.size());
  //other code
  </code></pre>
  
  <p>The filtering works and I only get the entities, that contain the compareString, but the paging doesn't work and I only get a single list of entities. When I don't use the filter the paging works correctly.</p>