java - How to check one arrayList to see if it contains parts of another? -
this question has reply here:
efficient intersection of 2 list<string> in java? 5 answersfind items in store match items in list. save list best list of items far
that line in pseudocode need translate java code. have 2 lists 1 called itemsneeded , 1 called itemsfound. need see if itemsneeded list contains items in itemsfound list. need save list. can demonstrate this?
you take brute forcefulness approach , way...
say have list store matches in, called savelist. i'm assuming items in lists of type string, should work object.
for(string item : itemsneeded) { if(itemsfound.contains(item)) { savelist.add(item); } }
java pseudocode
No comments:
Post a Comment