java.lang.Object
com.sportradar.livedata.sdk.common.classes.Nulls

public final class Nulls extends Object

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 Details

    • EMPTY_STRINGS

      public static final String[] EMPTY_STRINGS
    • EMPTY_OBJECTS

      public static final Object[] 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

      public static <T extends Number> T nullToZero(T value)
    • nte

      public static String nte(String str)
      Convert null string to empty string. Non-null string returned as is.
      Parameters:
      str - test value
      Returns:
      empty or given value.
    • nullToEmpty

      public static String nullToEmpty(String str)
    • nte

      public static String[] nte(String[] strings)
    • nullToEmpty

      public static String[] nullToEmpty(String[] strings)
    • nte

      public static Object[] nte(Object[] objects)
    • nullToEmpty

      public static Object[] nullToEmpty(Object[] objects)
    • 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

      public static <T> Collection<T> nte(Collection<T> collection)
    • nullToEmpty

      public static <T> Collection<T> nullToEmpty(Collection<T> collection)
    • nte

      public static <T> List<T> nte(List<T> list)
    • nullToEmpty

      public static <T> List<T> nullToEmpty(List<T> list)
    • nte

      public static <T> Set<T> nte(Set<T> set)
    • nullToEmpty

      public static <T> Set<T> nullToEmpty(Set<T> set)
    • nte

      public static <K, V> Map<K,V> nte(Map<K,V> map)
    • nullToEmpty

      public static <K, V> Map<K,V> nullToEmpty(Map<K,V> map)
    • etn

      public static String etn(String str)
    • emptyToNull

      public static String emptyToNull(String str)
    • etn

      public static <T> List<T> etn(List<T> list)
    • emptyToNull

      public static <T> List<T> emptyToNull(List<T> list)
    • etn

      public static <T> Set<T> etn(Set<T> set)
    • emptyToNull

      public static <T> Set<T> emptyToNull(Set<T> set)
    • etn

      public static <K, V> Map<K,V> etn(Map<K,V> map)
    • emptyToNull

      public static <K, V> Map<K,V> emptyToNull(Map<K,V> map)
    • 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

      public static <T> T checkNotNull(T reference, @Nullable Object errorMessage)
    • checkNotNull

      public static <T> T checkNotNull(T reference, @Nullable String errorMessageTemplate, @Nullable Object... errorMessageArgs)