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 String
capitalize(String str)
static String
coalesce(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 int
indexOf(String[] strings, String element, int missingIndex)
static <C extends Collection<T>,T>
booleanisEmpty(C collection)
static boolean
isEmpty(String string)
static <T> boolean
isEmpty(T[] array)
static <C extends Collection<T>,T>
booleanisNotEmpty(C collection)
static boolean
isNotEmpty(String string)
static <T> boolean
isNotEmpty(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 <K,V>
Map<K,V>put(Map<K,V> map, K k, V v)
static String
requireNonEmpty(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)
-
-