Package io.leangen.graphql.util
Class Utils
- java.lang.Object
-
- io.leangen.graphql.util.Utils
-
public class Utils extends Object
A collection of utility methods
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Predicate<T>acceptAll()static <T> List<T>asList(T[] elements)static Stringcapitalize(String str)static Stringcoalesce(String... values)static <T> Stream<T>concat(Stream<T>... streams)static <C extends Collection<T>,T>
CdefaultIfEmpty(C collection, C fallback)static String[]emptyArray()static String[]emptyIfNull(String[] array)static <T> Stream<T>extractInstances(Collection<? super T> collection, Class<T> clazz)static <T> CompletableFuture<T>failedFuture(Throwable throwable)static <T> Stream<T>flatten(Optional<? extends T>... optionals)static intindexOf(String[] strings, String element, int missingIndex)static <C extends Collection<T>,T>
booleanisEmpty(C collection)static booleanisEmpty(String string)static <T> booleanisEmpty(T[] array)static <C extends Collection<T>,T>
booleanisNotEmpty(C collection)static booleanisNotEmpty(String string)static <T> booleanisNotEmpty(T[] array)static <T> Optional<T>or(Optional<T> left, Supplier<Optional<T>> right)static <T> Optional<T>or(Optional<T> left, Optional<T> right)static StringrequireNonEmpty(String value)static <T> T[]requireNonEmpty(T[] array)static <T> List<T>singletonList(T element)static <T> Stream<T>stream(Collection<T> collection)
-
-
-
Method Detail
-
flatten
@SafeVarargs public static <T> Stream<T> flatten(Optional<? extends T>... optionals)
-
isEmpty
public static boolean isEmpty(String string)
-
isNotEmpty
public static boolean isNotEmpty(String string)
-
isEmpty
public static <T> boolean isEmpty(T[] array)
-
isNotEmpty
public static <T> boolean isNotEmpty(T[] array)
-
requireNonEmpty
public static <T> T[] requireNonEmpty(T[] array)
-
concat
@SafeVarargs public static <T> Stream<T> concat(Stream<T>... streams)
-
isEmpty
public static <C extends Collection<T>,T> boolean isEmpty(C collection)
-
isNotEmpty
public static <C extends Collection<T>,T> boolean isNotEmpty(C collection)
-
defaultIfEmpty
public static <C extends Collection<T>,T> C defaultIfEmpty(C collection, C fallback)
-
stream
public static <T> Stream<T> stream(Collection<T> collection)
-
extractInstances
public static <T> Stream<T> extractInstances(Collection<? super T> collection, Class<T> clazz)
-
emptyArray
public static String[] emptyArray()
-
singletonList
public static <T> List<T> singletonList(T element)
-
asList
public static <T> List<T> asList(T[] elements)
-
acceptAll
public static <T> Predicate<T> acceptAll()
-
failedFuture
public static <T> CompletableFuture<T> failedFuture(Throwable throwable)
-
-