Class Nulls
java.lang.Object
com.sportradar.livedata.sdk.common.classes.Nulls
Basically this is versions of 2 methods: etn (empty to null) and nte (null to empty). If you are calling Nulls.nte(), compiler will find needed version itself by collection you had passed. For example: Nulls.nte(new List()) will call public static <T> List<T> nte(final List<T> list).
As a result, code: if(list != null){ for(obj : list){} } will turn into: for(obj : Nulls.nte(list)){}-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TcheckNotNull(T reference) static <T> TcheckNotNull(T reference, Object errorMessage) static <T> TcheckNotNull(T reference, String errorMessageTemplate, Object... errorMessageArgs) static StringemptyToNull(String str) static <T> List<T> emptyToNull(List<T> list) static <K,V> Map <K, V> emptyToNull(Map<K, V> map) static <T> Set<T> emptyToNull(Set<T> set) static Stringstatic <T> List<T> static <K,V> Map <K, V> static <T> Set<T> static <T> TfirstNonNull(T first, T second) static <T> TfirstNonNullIfExists(T... values) static <T> booleanhasNotNulls(T... objs) static <T> booleanhasNulls(T... objs) static byte[]nte(byte[] bytes) static int[]nte(int[] ints) static long[]nte(long[] longs) static Object[]static StringConvertnullstring to empty string.static String[]static <T> Collection<T> nte(Collection<T> collection) static <T> List<T> static <K,V> Map <K, V> static <T> Set<T> static byte[]nullToEmpty(byte[] bytes) static int[]nullToEmpty(int[] ints) static long[]nullToEmpty(long[] longs) static Object[]nullToEmpty(Object[] objects) static StringnullToEmpty(String str) static String[]nullToEmpty(String[] strings) static <T> Collection<T> nullToEmpty(Collection<T> collection) static <T> List<T> nullToEmpty(List<T> list) static <K,V> Map <K, V> nullToEmpty(Map<K, V> map) static <T> Set<T> nullToEmpty(Set<T> set) static <T extends Number>
TnullToZero(T value)
-
Field Details
-
EMPTY_STRINGS
-
EMPTY_OBJECTS
-
EMPTY_BYTES
public static final byte[] EMPTY_BYTES -
EMPTY_INTS
public static final int[] EMPTY_INTS -
EMPTY_LONGS
public static final long[] EMPTY_LONGS
-
-
Method Details
-
nullToZero
-
nte
Convertnullstring to empty string. Non-null string returned as is.- Parameters:
str- test value- Returns:
- empty or given value.
-
nullToEmpty
-
nte
-
nullToEmpty
-
nte
-
nullToEmpty
-
nte
public static byte[] nte(byte[] bytes) -
nullToEmpty
public static byte[] nullToEmpty(byte[] bytes) -
nte
public static int[] nte(int[] ints) -
nullToEmpty
public static int[] nullToEmpty(int[] ints) -
nte
public static long[] nte(long[] longs) -
nullToEmpty
public static long[] nullToEmpty(long[] longs) -
nte
-
nullToEmpty
-
nte
-
nullToEmpty
-
nte
-
nullToEmpty
-
nte
-
nullToEmpty
-
etn
-
emptyToNull
-
etn
-
emptyToNull
-
etn
-
emptyToNull
-
etn
-
emptyToNull
-
hasNulls
public static <T> boolean hasNulls(T... objs) -
hasNotNulls
public static <T> boolean hasNotNulls(T... objs) -
firstNonNullIfExists
public static <T> T firstNonNullIfExists(T... values) -
firstNonNull
public static <T> T firstNonNull(T first, T second) -
checkNotNull
public static <T> T checkNotNull(T reference) -
checkNotNull
-
checkNotNull
-