File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
src/main/java/network/brightspots/rcv Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -247,18 +247,12 @@ public Set<RawContestConfig.Candidate> gatherUnknownCandidates(
247247 }
248248
249249 Set <String > knownNames = config .getCandidateNames ();
250- Set <Map .Entry <String , Candidate >> codesFoundInManifest = candidateCodesToCandidates .entrySet ();
251250
252- Set <RawContestConfig .Candidate > unknownCandidates = new HashSet <>();
253- for (Map .Entry <String , Candidate > entry : codesFoundInManifest ) {
254- Candidate candidate = entry .getValue ();
255- if (knownNames .contains (candidate .name )) {
256- continue ;
257- }
258- unknownCandidates .add (new RawContestConfig .Candidate (candidate .name , entry .getKey (), false ));
259- }
260-
261- return unknownCandidates ;
251+ // Return the candidate codes that are not in the knownNames set
252+ return candidateCodesToCandidates .entrySet ().stream ()
253+ .filter (entry -> !knownNames .contains (entry .getValue ().name ))
254+ .map (entry -> new RawContestConfig .Candidate (entry .getValue ().name , entry .getKey ()))
255+ .collect (Collectors .toSet ());
262256 }
263257
264258 // parse the CVR file or files into a List of CastVoteRecords for tabulation
Original file line number Diff line number Diff line change @@ -304,6 +304,10 @@ public static class Candidate {
304304 this (name , null , false );
305305 }
306306
307+ Candidate (String name , String newlineSeparatedAliases ) {
308+ this (name , newlineSeparatedAliases , false );
309+ }
310+
307311 Candidate (String name , String newlineSeparatedAliases , boolean excluded ) {
308312 this .name .setValue (name );
309313 this .excluded .setValue (excluded );
You can’t perform that action at this time.
0 commit comments