dev*_*l08 2 java collections linked-list linkedhashset
我试图从使用Set Interface的String类型的List对象中删除重复项,但我遇到的问题是它也重新排序我的列表,这是我不想要的.我想保留列表的顺序并仅删除重复项?
static List<String> StopNames = new ArrayList<String>();
StopNames.add(sCurrentLine);
Set<String> set = new HashSet<String>(StopNames);
for (String string : set) {
System.out.println("Printing Set "+string);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
177 次 |
| 最近记录: |