修改注释

dev
ZhouXY108 2024-10-21 18:18:53 +08:00
parent 66d0e811f7
commit e5cd981508
2 changed files with 66 additions and 27 deletions

View File

@ -26,13 +26,18 @@ import javax.annotation.Nullable;
public class ArrayTools { public class ArrayTools {
// empty arrays // #region - empty arrays
public static final char[] EMPTY_CHAR_ARRAY = {}; public static final char[] EMPTY_CHAR_ARRAY = {};
public static final int[] EMPTY_INTEGER_ARRAY = {}; public static final int[] EMPTY_INTEGER_ARRAY = {};
public static final long[] EMPTY_LONG_ARRAY = {}; public static final long[] EMPTY_LONG_ARRAY = {};
public static final float[] EMPTY_FLOAT_ARRAY = {}; public static final float[] EMPTY_FLOAT_ARRAY = {};
public static final double[] EMPTY_DOUBLE_ARRAY = {}; public static final double[] EMPTY_DOUBLE_ARRAY = {};
// #endregion
// #region - isNullOrEmpty
// isNullOrEmpty // isNullOrEmpty
/** /**
@ -101,6 +106,10 @@ public class ArrayTools {
return arr == null || arr.length == 0; return arr == null || arr.length == 0;
} }
// #endregion
// #region - isNotEmpty
// isNotEmpty // isNotEmpty
/** /**
* *
@ -168,7 +177,9 @@ public class ArrayTools {
return arr != null && arr.length > 0; return arr != null && arr.length > 0;
} }
// isAllElementsNotNull // #endregion
// #region - isAllElementsNotNull
/** /**
* *
@ -195,7 +206,9 @@ public class ArrayTools {
return true; return true;
} }
// concat // #endregion
// #region - concat
/** /**
* *
@ -322,6 +335,10 @@ public class ArrayTools {
return result; return result;
} }
// #endregion
// #region - fill
// fill - char // fill - char
public static void fill(char[] a, char... values) { public static void fill(char[] a, char... values) {
@ -475,7 +492,13 @@ public class ArrayTools {
} }
} }
// #endregion
// #region - private constructor
private ArrayTools() { private ArrayTools() {
throw new IllegalStateException("Utility class"); throw new IllegalStateException("Utility class");
} }
// #endregion
} }

View File

@ -38,6 +38,8 @@ import javax.annotation.Nonnull;
*/ */
public class AssertTools { public class AssertTools {
// #region - checkArgument
public static <T> void checkArgumentNotNull(T argument) { public static <T> void checkArgumentNotNull(T argument) {
checkCondition(argument != null, () -> new IllegalArgumentException("The argument cannot be null.")); checkCondition(argument != null, () -> new IllegalArgumentException("The argument cannot be null."));
} }
@ -70,6 +72,10 @@ public class AssertTools {
checkCondition(condition, () -> new IllegalArgumentException(String.format(format, args))); checkCondition(condition, () -> new IllegalArgumentException(String.format(format, args)));
} }
// #endregion
// #region - checkState
public static void checkState(boolean condition) { public static void checkState(boolean condition) {
checkCondition(condition, IllegalStateException::new); checkCondition(condition, IllegalStateException::new);
} }
@ -86,6 +92,10 @@ public class AssertTools {
checkCondition(condition, () -> new IllegalStateException(String.format(format, args))); checkCondition(condition, () -> new IllegalStateException(String.format(format, args)));
} }
// #endregion
// #region - checkCondition
public static <T extends Exception> void checkCondition(boolean condition, @Nonnull Supplier<T> e) public static <T extends Exception> void checkCondition(boolean condition, @Nonnull Supplier<T> e)
throws T { throws T {
if (!condition) { if (!condition) {
@ -93,7 +103,13 @@ public class AssertTools {
} }
} }
// #endregion
// #region - private constructor
private AssertTools() { private AssertTools() {
throw new IllegalStateException("Utility class"); throw new IllegalStateException("Utility class");
} }
// #endregion
} }