@Override
 protected boolean match(Post msg) {
   if (msg.getName() != null && msg.getName().toLowerCase().indexOf(keyword) > -1) return true;
   if (msg.getCaption() != null && msg.getCaption().toLowerCase().indexOf(keyword) > -1)
     return true;
   if (msg.getDescription() != null && msg.getDescription().toLowerCase().indexOf(keyword) > -1)
     return true;
   if (msg.getMessage() != null && msg.getMessage().toLowerCase().indexOf(keyword) > -1)
     return true;
   return false;
 }
Exemplo n.º 2
0
 private void readFilteredPosts(List<Post> posts) {
   for (Post post : posts) {
     System.out.println(post.getMessage());
   }
 }