Package io.activej.common
Class Utils
java.lang.Object
io.activej.common.Utils
Utility helper methods for internal use
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanarraysEquals(byte[] array1, int pos1, int len1, byte[] array2, int pos2, int len2) static intinitialCapacity(int initialSize) static booleanisBijection(Map<?, ?> map) static <T> Stream<T>static <T> Stream<T>iterate(T seed, Predicate<? super T> hasNext, UnaryOperator<T> f) static <T> BinaryOperator<T>static <T> TnonNullElse(T value1, T defaultValue) static StringnonNullElseEmpty(@Nullable String value) static <T> List<T>nonNullElseEmpty(@Nullable List<T> list) static <K,V> Map<K, V> nonNullElseEmpty(@Nullable Map<K, V> map) static <T> Set<T>nonNullElseEmpty(@Nullable Set<T> set) static <T> TnonNullElseGet(T value, Supplier<? extends T> defaultValue) static <T,E extends Throwable>
TnonNullOrException(T value, Supplier<E> exceptionSupplier) static <V,A> V nullify(V value, BiConsumer<? super V, A> action, A actionArg) static <V> Vstatic <V,A> V replace(V value, V newValue, BiConsumer<? super V, A> action, A actionArg) static <V> Vstatic <T> StringtoString(Collection<? extends T> collection) static <T> StringtoString(Collection<? extends T> collection, int limit) static <K,V> String static <K,V> String
-
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
-
nonNullElseEmpty
-
nonNullElseEmpty
-
nonNullElseEmpty
-
nonNullElseEmpty
-
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
-
iterate
-
iterate
-
noMergeFunction
-
initialCapacity
public static int initialCapacity(int initialSize) -
toString
-
toString
-
toString
-
toString
-