Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save evaldeslacasa/3cb37d4fb9afd636700d10261d73d8d8 to your computer and use it in GitHub Desktop.

Select an option

Save evaldeslacasa/3cb37d4fb9afd636700d10261d73d8d8 to your computer and use it in GitHub Desktop.
Code to add unique long values to HashSet
String[] ids = StringUtil.split(idStr, StringPool.COMMA);
Set<String> idSet = new HashSet<String>();
for (int i = 0; i < ids.length; i++) {
if(!idSet.contains(ids[i])){
idSet.add(ids[i]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment