Skip to content

Commit

Permalink
More small fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
0x3333 committed Oct 24, 2023
1 parent e5bccce commit e81d38f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/java/org/sqids/Sqids.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* <p>
* This is the Java implementation of https://github.com/sqids/sqids-spec.
*
* This implementation is immutable, thread-safe, no lock is necessary.
* This implementation is immutable and thread-safe, no lock is necessary.
*/
public class Sqids {
private static final int MIN_ALPHABET_LENGTH = 3;
Expand All @@ -27,10 +27,10 @@ public class Sqids {
private final Set<String> blockList;

private Sqids(final Builder builder) {
String alphabet = builder.alphabet;
int alphabetLength = alphabet.length();
int minLength = builder.minLength;
Set<String> blockList = new HashSet<>(builder.blockList);
final String alphabet = builder.alphabet;
final int alphabetLength = alphabet.length();
final int minLength = builder.minLength;
final Set<String> blockList = new HashSet<>(builder.blockList);

if (alphabet.getBytes().length != alphabetLength) {
throw new IllegalArgumentException("Alphabet cannot contain multibyte characters");
Expand All @@ -48,8 +48,8 @@ private Sqids(final Builder builder) {
throw new IllegalArgumentException("Minimum length has to be between 0 and " + MIN_LENGTH_LIMIT);
}

Set<String> filteredBlockList = new HashSet<>();
List<String> alphabetChars = new ArrayList<>(Arrays.asList(alphabet.toLowerCase().split("")));
final Set<String> filteredBlockList = new HashSet<>();
final List<String> alphabetChars = new ArrayList<>(Arrays.asList(alphabet.toLowerCase().split("")));
for (String word : blockList) {
if (word.length() >= MIN_BLOCK_LIST_WORD_LENGTH) {
word = word.toLowerCase();
Expand Down

0 comments on commit e81d38f

Please sign in to comment.