public class IsNot extends Object
static utility methods intended
to operate boolean checks on objects.
This class provides null-safe operations for the most
common checks over Objects, Strings, Collections
Maps, arrays and objects that implement the Emptily interface.
The main aim of this class is to provide an easy and readable way
to perform the most common checks in conditional statements and in
functional statements like those provided by Stream
and Optional.
Object is NOT nullString, a Collection, a Map, an array
or an implementation of the Emptily interface is NOT emptyString does NOT contain only characters
satisfying Character.isWhitespace(char)
This utility class can be used in if statements like:
if( IsNot.empty(collection) )
// Do something
if( IsNot.blank(string) )
// Do something
or can be used as Predicates in statements like:
collection.stream().filter( IsNot::NULL ).// Do something or optional.filter( IsNot::blank ).// Do something
| Modifier and Type | Method and Description |
|---|---|
static boolean |
blank(String value)
Checks if the given value is not
null,
nor empty and contains characters that do not satisfy
the check performed by Character.isWhitespace(char). |
static boolean |
empty(boolean[] value)
Checks if the given value is not
null nor empty. |
static boolean |
empty(byte[] value)
Checks if the given value is not
null nor empty. |
static boolean |
empty(char[] value)
Checks if the given value is not
null nor empty. |
static boolean |
empty(Collection<?> value)
Checks if the given value is not
null nor empty. |
static boolean |
empty(double[] value)
Checks if the given value is not
null nor empty. |
static boolean |
empty(Emptily value)
Checks if the given value is not
null nor empty. |
static boolean |
empty(float[] value)
Checks if the given value is not
null nor empty. |
static boolean |
empty(int[] value)
Checks if the given value is not
null nor empty. |
static boolean |
empty(long[] value)
Checks if the given value is not
null nor empty. |
static boolean |
empty(Map<?,?> value)
Checks if the given value is not
null nor empty. |
static boolean |
empty(short[] value)
Checks if the given value is not
null nor empty. |
static boolean |
empty(String value)
Checks if the given value is not
null nor empty. |
static <V> boolean |
empty(V[] value)
Checks if the given value is not
null nor empty. |
static boolean |
NULL(Object value)
Checks if the given value is not
null. |
public static boolean NULL(Object value)
null.
Since null is a keyword and therefore
cannot be used as a method name, we choose
to name the method in upper case.
value - the value to check.false if the value is null.public static boolean empty(Emptily value)
null nor empty.value - the value to check.false if the value is null or empty.public static boolean empty(String value)
null nor empty.value - the value to check.false if the value is null or empty.public static boolean blank(String value)
null,
nor empty and contains characters that do not satisfy
the check performed by Character.isWhitespace(char).value - the value to check.false if the value is null, empty
or contains only white spaces.public static boolean empty(Collection<?> value)
null nor empty.value - the value to check.false if the value is null or empty.public static boolean empty(Map<?,?> value)
null nor empty.value - the value to check.false if the value is null or empty.public static <V> boolean empty(V[] value)
null nor empty.V - type of the elements in the array.value - the value to check.false if the value is null or empty.public static boolean empty(boolean[] value)
null nor empty.value - the value to check.false if the value is null or empty.public static boolean empty(char[] value)
null nor empty.value - the value to check.false if the value is null or empty.public static boolean empty(byte[] value)
null nor empty.value - the value to check.false if the value is null or empty.public static boolean empty(short[] value)
null nor empty.value - the value to check.false if the value is null or empty.public static boolean empty(int[] value)
null nor empty.value - the value to check.false if the value is null or empty.public static boolean empty(float[] value)
null nor empty.value - the value to check.false if the value is null or empty.public static boolean empty(long[] value)
null nor empty.value - the value to check.false if the value is null or empty.public static boolean empty(double[] value)
null nor empty.value - the value to check.false if the value is null or empty.Copyright © 2011–2020 Nerd4j. All rights reserved.