Created
April 1, 2016 17:52
-
-
Save evaldeslacasa/3cb37d4fb9afd636700d10261d73d8d8 to your computer and use it in GitHub Desktop.
Code to add unique long values to HashSet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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