Skip to content

Commit

Permalink
refactor: refactoring matchers.Match
Browse files Browse the repository at this point in the history
  • Loading branch information
vvatanabe committed Aug 19, 2023
1 parent e733acd commit 3d44718
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/java/com/nulabinc/zxcvbn/matchers/Match.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ private Match(Builder builder) {
this.dictionaryName = builder.dictionaryName;
this.reversed = builder.reversed;
this.l33t = builder.l33t;
if (builder.sub == null) builder.sub = new HashMap<>();
this.sub = builder.sub;
this.subDisplay = builder.subDisplay;
this.sequenceName = builder.sequenceName;
Expand All @@ -59,7 +58,6 @@ private Match(Builder builder) {
this.regexMatch = builder.regexMatch;
this.baseToken = builder.baseToken;
this.baseGuesses = builder.baseGuesses;
if (builder.baseMatches == null) builder.baseMatches = new ArrayList<>();
this.baseMatches = builder.baseMatches;
this.repeatCount = builder.repeatCount;
this.graph = builder.graph;
Expand Down Expand Up @@ -144,7 +142,7 @@ public Builder l33t(boolean l33t) {
}

public Builder sub(Map<Character, Character> sub) {
this.sub = sub;
this.sub = sub == null ? new HashMap<Character, Character>() : sub;
return this;
}

Expand Down Expand Up @@ -189,7 +187,7 @@ public Builder baseGuesses(double baseGuesses) {
}

public Builder baseMatches(List<Match> baseMatches) {
this.baseMatches = baseMatches;
this.baseMatches = baseMatches == null ? new ArrayList<Match>() : baseMatches;
return this;
}

Expand Down

0 comments on commit 3d44718

Please sign in to comment.