Fix duplicates

This commit is contained in:
Gabriel Augendre 2016-04-18 17:36:22 +02:00
parent d62aba0f72
commit 3a3c95a333
No known key found for this signature in database
GPG key ID: D2B6A5B41FC438B1

View file

@ -8,10 +8,7 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.text.Normalizer; import java.text.Normalizer;
import java.util.Arrays; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -32,7 +29,7 @@ public class ComputeResults implements Runnable {
public void run() { public void run() {
try { try {
Path filePath = Paths.get(file.getAbsolutePath()); Path filePath = Paths.get(file.getAbsolutePath());
List<String> validStrings = Files.lines(filePath).parallel().filter(this::isValid).collect(Collectors.toList()); Set<String> validStrings = Files.lines(filePath).parallel().filter(this::isValid).collect(Collectors.toSet());
mainPanel.getValidNamesList().setListData(validStrings.toArray()); mainPanel.getValidNamesList().setListData(validStrings.toArray());
} }
catch (FileNotFoundException e) { catch (FileNotFoundException e) {