I am trying to search through a sentence and return it if it contains the specific "keyword" but atm it only work if the search is exactly the same as the message, so if the sentence is "hello my name is ben" then the search wont work with only "ben" or "hello" but I would have to use "hello my name is ben" for it to display, How would I get this to work. Thanks
public ArrayList<Message> getMessageByKeyword(String messageBody){
ArrayList<Message> keyword = new ArrayList<>();
for( Message p : this.myMessages)
if( p.getMessageBody() == messageBody)
{
keyword.add( p );
}
return keyword;
}