Skip to content

Commit

Permalink
fix: use another way to initialize this instance in L33tMatcher
Browse files Browse the repository at this point in the history
  • Loading branch information
vvatanabe committed Aug 28, 2023
1 parent cbac396 commit c1a1331
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions src/main/java/com/nulabinc/zxcvbn/matchers/L33tMatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@
public class L33tMatcher extends BaseMatcher {

private final Map<String, Map<String, Integer>> rankedDictionaries;
private static final Map<Character, List<Character>> L33T_TABLE =
Collections.unmodifiableMap(
new HashMap<Character, List<Character>>() {
{
put('a', Arrays.asList('4', '@'));
put('b', Collections.singletonList('8'));
put('c', Arrays.asList('(', '{', '[', '<'));
put('e', Collections.singletonList('3'));
put('g', Arrays.asList('6', '9'));
put('i', Arrays.asList('1', '!', '|'));
put('l', Arrays.asList('1', '|', '7'));
put('o', Collections.singletonList('0'));
put('s', Arrays.asList('$', '5'));
put('t', Arrays.asList('+', '7'));
put('x', Collections.singletonList('%'));
put('z', Collections.singletonList('2'));
}
});
private static final Map<Character, List<Character>> L33T_TABLE;

static {
Map<Character, List<Character>> table = new HashMap<>();
table.put('a', Arrays.asList('4', '@'));
table.put('b', Collections.singletonList('8'));
table.put('c', Arrays.asList('(', '{', '[', '<'));
table.put('e', Collections.singletonList('3'));
table.put('g', Arrays.asList('6', '9'));
table.put('i', Arrays.asList('1', '!', '|'));
table.put('l', Arrays.asList('1', '|', '7'));
table.put('o', Collections.singletonList('0'));
table.put('s', Arrays.asList('$', '5'));
table.put('t', Arrays.asList('+', '7'));
table.put('x', Collections.singletonList('%'));
table.put('z', Collections.singletonList('2'));
L33T_TABLE = Collections.unmodifiableMap(table);
}

public L33tMatcher(Context context, Map<String, Map<String, Integer>> rankedDictionaries) {
super(context);
Expand Down

0 comments on commit c1a1331

Please sign in to comment.