perf: 简单优化代码 (#63 @Gitea)

This commit is contained in:
2025-09-03 21:01:50 +08:00
parent 8f451e7eb9
commit 15e07901e6
5 changed files with 7 additions and 3 deletions

View File

@@ -154,7 +154,7 @@ public final class EnumTools {
*/
@Nullable
public static <E extends Enum<?>> Integer checkOrdinalNullable(Class<E> enumType, @Nullable Integer ordinal) {
return checkOrdinalOrDefault(enumType, ordinal, (Integer) null);
return checkOrdinalOrDefault(enumType, ordinal, null);
}
/**

View File

@@ -33,6 +33,7 @@ import xyz.zhouxy.plusone.commons.annotation.StaticFactoryMethod;
/**
* 枚举类
*
* <p>
* 参考 <a href="https://lostechies.com/jimmybogard/2008/08/12/enumeration-classes/">Enumeration classes</a>
*
* @author ZhouXY108 <luquanlion@outlook.com>

View File

@@ -36,7 +36,7 @@ public final class RandomTools {
private static final SecureRandom DEFAULT_SECURE_RANDOM;
static {
SecureRandom secureRandom = null;
SecureRandom secureRandom;
try {
secureRandom = SecureRandom.getInstanceStrong(); // 获取高强度安全随机数生成器
}

View File

@@ -363,7 +363,7 @@ public final class RegexTools {
this.flags = flags;
}
private final Pattern compilePattern() {
private Pattern compilePattern() {
return Pattern.compile(regex, flags);
}

View File

@@ -177,6 +177,9 @@ public class StringTools {
*/
@Beta
public static boolean isURL(@Nullable final String cs) {
if (cs == null) {
return false;
}
try {
new URL(cs);
} catch (MalformedURLException e) {