Skip to content

Commit

Permalink
Reduce the calling of lowercaseId.length().
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechen116 authored Oct 26, 2023
1 parent 1743e0c commit 73c44eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/sqids/Sqids.java
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ private long toNumber(final String id, final String alphabet) {
}

private boolean isBlockedId(final String id) {
String lowercaseId = id.toLowerCase();

final String lowercaseId = id.toLowerCase();
final int lowercaseIdLength = lowercaseId.length();
for (String word : this.blockList) {
if (word.length() <= lowercaseId.length()) {
if (lowercaseId.length() <= 3 || word.length() <= 3) {
if (word.length() <= lowercaseIdLength) {
if (lowercaseIdLength <= 3 || word.length() <= 3) {
if (lowercaseId.equals(word)) {
return true;
}
Expand Down

0 comments on commit 73c44eb

Please sign in to comment.