public final class object extends StaticObject
| Modifier and Type | Field and Description |
|---|---|
static Function<Object,Boolean> |
NonNull
A
null checking predicate which can be used to check an array
for null values. |
static Function<Verifiable,Boolean> |
Verify
Verifies
Verifiable array elements. |
| Modifier and Type | Method and Description |
|---|---|
static double |
checkProbability(double p)
Check if the given double value is within the closed range
[0, 1]. |
static <C extends Comparable<? super C>> |
CheckRange(C min,
C max)
A range checking predicate which can be used to check whether the elements
of an array are within an given range.
|
static boolean |
eq(boolean[] a,
boolean[] b)
Compares the two given
boolean arrays. |
static boolean |
eq(boolean a,
boolean b)
Compares the two given
boolean values. |
static boolean |
eq(byte[] a,
byte[] b)
Compares the two given
byte arrays. |
static boolean |
eq(byte a,
byte b)
Compares the two given
byte values. |
static boolean |
eq(char[] a,
char[] b)
Compares the two given
char arrays. |
static boolean |
eq(char a,
char b)
Compares the two given
char values. |
static boolean |
eq(double[] a,
double[] b)
Compares the two given
double arrays. |
static boolean |
eq(double a,
double b)
Compares the two given
double values. |
static boolean |
eq(Enum<?> a,
Enum<?> b)
Compares the two given
Enum values. |
static boolean |
eq(float[] a,
float[] b)
Compares the two given
float arrays. |
static boolean |
eq(float a,
float b)
Compares the two given
float values. |
static boolean |
eq(int[] a,
int[] b)
Compares the two given
int arrays. |
static boolean |
eq(int a,
int b)
Compares the two given
int values. |
static boolean |
eq(long[] a,
long[] b)
Compares the two given
long arrays. |
static boolean |
eq(long a,
long b)
Compares the two given
long values. |
static boolean |
eq(Object[] a,
Object[] b)
Compares the two given
Object arrays. |
static boolean |
eq(Object a,
Object b)
Compares the two given
Object values. |
static boolean |
eq(Seq<?> a,
Seq<?> b)
Compares the two given
Seq values. |
static boolean |
eq(short[] a,
short[] b)
Compares the two given
short arrays. |
static boolean |
eq(short a,
short b)
Compares the two given
short values. |
static HashCodeBuilder |
hashCodeOf(Class<?> type)
Create a HashCodeBuilder for the given type.
|
static double |
nonNegative(double value)
Check if the specified value is not negative.
|
static double |
nonNegative(double value,
String message)
Check if the specified value is not negative.
|
static int |
nonNegative(int length)
Check if the given integer is negative.
|
static Function<Object,Boolean> |
NonNull(String message)
A
null checking predicate which can be used to check an array
for null values. |
static <T> T |
nonNull(T obj)
Deprecated.
Use
Objects.requireNonNull(Object) instead. |
static <T> T |
nonNull(T obj,
String message)
Deprecated.
Use
Objects.requireNonNull(Object, String)
instead. |
static String |
str(byte... data)
Deprecated.
Use
bit.toByteString(byte...) instead. |
static String |
str(Object a)
Deprecated.
Use
Objects.toString(Object) instead. |
public static final Function<Verifiable,Boolean> Verify
Verifiable array elements. All elements are valid if the
condition
arrays.forAll(Verify) == truepublic static final Function<Object,Boolean> NonNull
null checking predicate which can be used to check an array
for null values. The following code will throw an
NullPointerException if one of the array elements is null.
final Array<String> array = ...
array.forEach(NonNull("Object"));
...
final String[] array = ...
arrays.forEach(array, NonNull);public static final <C extends Comparable<? super C>> Function<C,Boolean> CheckRange(C min, C max)
IllegalArgumentException is thrown. If one value is null,
an NullPointerException is thrown.
The following code will throw an IllegalArgumentException if the
integers in the array are smaller than zero and greater than 9.
final Array<Integer> array = ...
arrays.forEach(CheckRange<(0, 10));public static final Function<Object,Boolean> NonNull(String message)
null checking predicate which can be used to check an array
for null values. The following code will throw an
NullPointerException if one of the array elements is null.
final Array<String> array = ...
array.forEach(NonNull("Object"));
...
final String[] array = ...
arrays.forEach(array, NonNull);@Deprecated public static <T> T nonNull(T obj, String message)
Objects.requireNonNull(Object, String)
instead.null.obj - the object to check.message - the error message.obj if not null.NullPointerException - if obj is null.@Deprecated public static <T> T nonNull(T obj)
Objects.requireNonNull(Object) instead.null.obj - the object to check.obj if not null.NullPointerException - if obj is null.public static double nonNegative(double value, String message)
value - the value to check.message - the exception message.IllegalArgumentException - if value < 0.public static double nonNegative(double value)
value - the value to check.IllegalArgumentException - if value < 0.public static int nonNegative(int length)
length - the value to check.NegativeArraySizeException - if the given length is smaller
than zero.public static double checkProbability(double p)
[0, 1].p - the probability to check.IllegalArgumentException - if p is not a valid probability.public static HashCodeBuilder hashCodeOf(Class<?> type)
type - the type the HashCodebuilder is created for.public static boolean eq(boolean a, boolean b)
boolean values.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(boolean[] a, boolean[] b)
boolean arrays.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(byte a, byte b)
byte values.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(byte[] a, byte[] b)
byte arrays.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(char a, char b)
char values.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(char[] a, char[] b)
char arrays.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(short a, short b)
short values.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(short[] a, short[] b)
short arrays.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(int a, int b)
int values.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(int[] a, int[] b)
int arrays.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(long a, long b)
long values.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(long[] a, long[] b)
long arrays.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(float a, float b)
float values.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(float[] a, float[] b)
float arrays.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(double a, double b)
double values.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(double[] a, double[] b)
double arrays.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(Enum<?> a, Enum<?> b)
Enum values.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(Object a, Object b)
Object values.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(Object[] a, Object[] b)
Object arrays.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.public static boolean eq(Seq<?> a, Seq<?> b)
Seq values.a - first value to compare.b - second value to compare.true if the given values are equal, false
otherwise.@Deprecated public static String str(Object a)
Objects.toString(Object) instead.a - the object.Objects.toString(Object)@Deprecated public static String str(byte... data)
bit.toByteString(byte...) instead.
Byte: 3 2 1 0
| | | |
Array: "11110011|10011101|01000000|00101010"
| | | |
Bit: 23 15 7 0
Only the array string is printed.data - the byte array to convert to a string.© 2007-2013 Franz Wilhelmstötter (2013-12-18 20:17)