KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to combine two string sets while filtering out redundant information, this is the solution I came up with, is there a better way that anyone can suggest? Perhaps something built in that I overlooked? Didn't have any luck with google. Set<String> oldStringSet = getOldStringSet(); Set<String> newStringSet = getNewStringSet(); for(String currentString : oldStringSet) { if (!newStringSet.contains(currentString)) { newStringSet.add(currentString); } }
Tags (comma-separated)
Save Edits
Cancel