I am trying to search for a keyword in the ArrayList
, and If keyword is found, It prints how many "Keyword" there is in the ArrayList
. But I get the print "No keywords found" no matter what keyword It is because the search method doesn't work for a reason.
Here's the code:
public ArrayList<Media> search(String keywordi)
{
keyword = keywordi;
System.out.println(keyword);
return (ArrayList<Media>) storage.stream()
.filter(m -> storage.contains(keyword))
.collect(Collectors.toList());
}
And
ArrayList<Media> result = (ArrayList<Media>) katalog.search("Tasty");
if(result.size()==0)
{
System.out.println("No keywords found.");
}
else
{
System.out.println(result.size()+" keywords found.");
}