perf: 简单优化代码 #63
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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>
|
||||
|
@@ -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(); // 获取高强度安全随机数生成器
|
||||
}
|
||||
|
@@ -363,7 +363,7 @@ public final class RegexTools {
|
||||
this.flags = flags;
|
||||
}
|
||||
|
||||
private final Pattern compilePattern() {
|
||||
private Pattern compilePattern() {
|
||||
return Pattern.compile(regex, flags);
|
||||
}
|
||||
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user