Class Utils

java.lang.Object
io.activej.common.Utils

@Internal public class Utils extends Object
Utility helper methods for internal use
  • Field Details

    • TO_STRING_LIMIT

      public static final int TO_STRING_LIMIT
  • Constructor Details

    • Utils

      public Utils()
  • Method Details

    • nonNullElse

      public static <T> T nonNullElse(@Nullable T value1, T defaultValue)
    • nonNullElseGet

      public static <T> T nonNullElseGet(@Nullable T value, Supplier<? extends T> defaultValue)
    • nonNullElseEmpty

      public static String nonNullElseEmpty(@Nullable @Nullable String value)
    • nonNullElseEmpty

      public static <T> Set<T> nonNullElseEmpty(@Nullable @Nullable Set<T> set)
    • nonNullElseEmpty

      public static <T> List<T> nonNullElseEmpty(@Nullable @Nullable List<T> list)
    • nonNullElseEmpty

      public static <K, V> Map<K,V> nonNullElseEmpty(@Nullable @Nullable Map<K,V> map)
    • nonNullOrException

      public static <T, E extends Throwable> T nonNullOrException(@Nullable T value, Supplier<E> exceptionSupplier) throws E
      Throws:
      E extends Throwable
    • nullify

      @Contract("_, _ -> null") @Nullable public static <V> V nullify(@Nullable V value, Consumer<? super V> action)
    • nullify

      @Contract("_, _, _ -> null") @Nullable public static <V, A> V nullify(@Nullable V value, BiConsumer<? super V,A> action, A actionArg)
    • replace

      @Nullable public static <V> V replace(@Nullable V value, @Nullable V newValue, Consumer<? super V> action)
    • replace

      @Nullable public static <V, A> V replace(@Nullable V value, @Nullable V newValue, BiConsumer<? super V,A> action, A actionArg)
    • arraysEquals

      public static boolean arraysEquals(byte[] array1, int pos1, int len1, byte[] array2, int pos2, int len2)
    • isBijection

      public static boolean isBijection(Map<?,?> map)
    • iterate

      public static <T> Stream<T> iterate(Supplier<? extends T> supplier, Predicate<? super T> hasNext)
    • iterate

      public static <T> Stream<T> iterate(T seed, Predicate<? super T> hasNext, UnaryOperator<T> f)
    • noMergeFunction

      public static <T> BinaryOperator<T> noMergeFunction()
    • initialCapacity

      public static int initialCapacity(int initialSize)
    • toString

      public static <T> String toString(Collection<? extends T> collection)
    • toString

      public static <K, V> String toString(Map<? extends K,? extends V> map)
    • toString

      public static <T> String toString(Collection<? extends T> collection, int limit)
    • toString

      public static <K, V> String toString(Map<? extends K,? extends V> map, int limit)