Package com.landawn.abacus.util
Class If
java.lang.Object
com.landawn.abacus.util.If
This class is mainly designed for functional programming.
Generally the traditional "
if-else
" or ternary operator: "? :
" is preferred over this class.- Author:
- HaiYang Li
-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic If
exists
(int index) true
forindex >= 0
,false
forindex < 0
.static If
is
(boolean b) Checks if is.static If
Checks if is null or empty or blank.static If
isEmpty
(boolean[] a) Checks if is null or empty.static If
isEmpty
(byte[] a) Checks if is null or empty.static If
isEmpty
(char[] a) Checks if is null or empty.static If
isEmpty
(double[] a) Checks if is null or empty.static If
isEmpty
(float[] a) Checks if is null or empty.static If
isEmpty
(int[] a) Checks if is null or empty.static If
isEmpty
(long[] a) Checks if is null or empty.static If
isEmpty
(short[] a) Checks if is null or empty.static If
isEmpty
(LongMultiset<?> s) Checks if is null or empty.static If
Checks if is null or empty.static If
Checks if is null or empty.static If
isEmpty
(PrimitiveList list) Checks if is null or empty.static If
Checks if is null or empty.static If
Checks if is null or empty.static If
isEmpty
(Collection<?> c) Checks if is null or empty.static If
Checks if is null or empty.static If
not
(boolean b) static If
Not null or empty or blank.static If
notEmpty
(boolean[] a) Not null or empty.static If
notEmpty
(byte[] a) Not null or empty.static If
notEmpty
(char[] a) Not null or empty.static If
notEmpty
(double[] a) Not null or empty.static If
notEmpty
(float[] a) Not null or empty.static If
notEmpty
(int[] a) Not null or empty.static If
notEmpty
(long[] a) Not null or empty.static If
notEmpty
(short[] a) Not null or empty.static If
notEmpty
(LongMultiset<?> s) Not null or empty.static If
Not null or empty.static If
Not null or empty.static If
notEmpty
(PrimitiveList list) Not null or empty.static If
Not null or empty.static If
Not null or empty.static If
notEmpty
(Collection<?> c) Not null or empty.static If
Not null or empty.then
(Throwables.Runnable<E> cmd) then
(U init, Throwables.Consumer<? super U, E> action) Then do nothing.
-
Method Details
-
is
Checks if is.- Parameters:
b
-- Returns:
-
not
- Parameters:
b
-- Returns:
-
exists
true
forindex >= 0
,false
forindex < 0
.- Parameters:
index
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
s
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
a
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
a
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
a
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
a
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
a
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
a
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
a
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
a
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
a
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
c
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
m
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
list
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
s
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
s
-- Returns:
-
isEmpty
Checks if is null or empty.- Parameters:
m
-- Returns:
-
isBlank
Checks if is null or empty or blank.- Parameters:
s
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
s
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
a
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
a
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
a
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
a
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
a
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
a
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
a
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
a
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
a
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
c
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
m
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
list
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
s
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
s
-- Returns:
-
notEmpty
Not null or empty.- Parameters:
m
-- Returns:
-
notBlank
Not null or empty or blank.- Parameters:
s
-- Returns:
-
thenDoNothing
Then do nothing.- Returns:
-
then
- Type Parameters:
E
-- Parameters:
cmd
-- Returns:
- Throws:
E
- the e
-
then
public <U,E extends Throwable> If.OrElse then(U init, Throwables.Consumer<? super U, E> action) throws E- Type Parameters:
U
-E
-- Parameters:
init
-action
-- Returns:
- Throws:
E
- the e
-
thenThrow
- Type Parameters:
E
-- Parameters:
exceptionSupplier
-- Returns:
- Throws:
E
- the e
-