📅  最后修改于: 2022-03-11 14:52:36.508000             🧑  作者: Mango
Set tokens = new HashSet(Arrays.asList(s.split("\n")));
StringBuilder resultBuilder = new StringBuilder();
boolean first = true;
for(String token : tokens) {
if(first) first = false;
else resultBuilder.append("\n")
resultBuilder.append(token);
}
String result = resultBuilder.toString();