Optimize flag operation

pull/194/merge
M66B 3 years ago
parent 1e10eb8fdf
commit e819451416

@ -156,10 +156,14 @@ public class EntityOperation {
boolean set = jargs.getBoolean(1); boolean set = jargs.getBoolean(1);
List<String> keywords = new ArrayList<>(Arrays.asList(message.keywords)); List<String> keywords = new ArrayList<>(Arrays.asList(message.keywords));
if (set == keywords.contains(keyword))
return;
while (keywords.remove(keyword)) while (keywords.remove(keyword))
; ;
if (set) if (set)
keywords.add(keyword); keywords.add(keyword);
Collections.sort(keywords); Collections.sort(keywords);
message.keywords = keywords.toArray(new String[0]); message.keywords = keywords.toArray(new String[0]);

Loading…
Cancel
Save