public final class GenericUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static Comparator<String> |
CASE_SENSITIVE_ORDER
The complement of
String.CASE_INSENSITIVE_ORDER |
static byte[] |
EMPTY_BYTE_ARRAY |
static Object[] |
EMPTY_OBJECT_ARRAY |
static String[] |
EMPTY_STRING_ARRAY |
static String |
QUOTES |
| Modifier and Type | Method and Description |
|---|---|
static <T extends Throwable> |
accumulateException(T current,
T extra)
Used to "accumulate" exceptions of the same type.
|
static <V extends Comparable<V>> |
asSortedSet(Collection<? extends V> values) |
static <V> SortedSet<V> |
asSortedSet(Comparator<? super V> comp,
Collection<? extends V> values) |
static int |
hashCode(long value) |
static boolean |
isEmpty(byte[] a) |
static boolean |
isEmpty(CharSequence cs) |
static boolean |
isEmpty(Collection<?> c) |
static <T> boolean |
isEmpty(Iterable<? extends T> iter) |
static <T> boolean |
isEmpty(Iterator<? extends T> iter) |
static boolean |
isEmpty(Map<?,?> m) |
static <T> boolean |
isEmpty(T... a) |
static String |
join(Iterable<?> iter,
char ch) |
static String |
join(Iterable<?> iter,
CharSequence sep) |
static String |
join(Iterator<?> iter,
char ch) |
static String |
join(Iterator<?> iter,
CharSequence sep) |
static <T> String |
join(T[] values,
char ch) |
static <T> String |
join(T[] values,
CharSequence sep) |
static int |
length(byte... a) |
static int |
length(CharSequence cs) |
static <T> int |
length(T... a) |
static <V extends Comparable<V>> |
naturalComparator() |
static <E extends Enum<E>> |
of(Collection<? extends E> values) |
static <E extends Enum<E>> |
of(E... values) |
static Throwable |
resolveExceptionCause(Throwable t) |
static int |
safeCompare(String s1,
String s2,
boolean caseSensitive) |
static int |
size(Collection<?> c) |
static int |
size(Map<?,?> m) |
static String[] |
split(String s,
char ch) |
static CharSequence |
stripDelimiters(CharSequence s,
char delim) |
static CharSequence |
stripQuotes(CharSequence s) |
static String |
trimToEmpty(String s) |
public static final byte[] EMPTY_BYTE_ARRAY
public static final String[] EMPTY_STRING_ARRAY
public static final Object[] EMPTY_OBJECT_ARRAY
public static final Comparator<String> CASE_SENSITIVE_ORDER
String.CASE_INSENSITIVE_ORDERpublic static final String QUOTES
public static int length(CharSequence cs)
public static boolean isEmpty(CharSequence cs)
public static <T> String join(T[] values, char ch)
public static <T> String join(T[] values, CharSequence sep)
public static String join(Iterable<?> iter, CharSequence sep)
public static String join(Iterator<?> iter, CharSequence sep)
public static int size(Collection<?> c)
public static boolean isEmpty(Collection<?> c)
public static int size(Map<?,?> m)
public static boolean isEmpty(Map<?,?> m)
public static boolean isEmpty(byte[] a)
public static int length(byte... a)
@SafeVarargs public static <T> int length(T... a)
public static <T> boolean isEmpty(Iterable<? extends T> iter)
public static <T> boolean isEmpty(Iterator<? extends T> iter)
@SafeVarargs public static <T> boolean isEmpty(T... a)
@SafeVarargs public static <E extends Enum<E>> Set<E> of(E... values)
public static <E extends Enum<E>> Set<E> of(Collection<? extends E> values)
public static <V extends Comparable<V>> Comparator<V> naturalComparator()
public static <V extends Comparable<V>> SortedSet<V> asSortedSet(Collection<? extends V> values)
public static <V> SortedSet<V> asSortedSet(Comparator<? super V> comp, Collection<? extends V> values)
V - The element typecomp - The (non-null) Comparator to usevalues - The values to be added (ignored if null)SortedSet containing the values (if any) sorted
using the provided comparatorpublic static CharSequence stripQuotes(CharSequence s)
s - The CharSequence to be checkedQUOTES
on both ends, then they are stripped, otherwise
nothing is donestripDelimiters(CharSequence, char)public static CharSequence stripDelimiters(CharSequence s, char delim)
s - The CharSequence to be checkeddelim - The expected delimiterpublic static Throwable resolveExceptionCause(Throwable t)
t - The original Throwable - ignored if nullThrowable.getCause() is non-null then
the cause, otherwise the original exception - null if
the original exception was nullpublic static <T extends Throwable> T accumulateException(T current, T extra)
null then the new one becomes the current,
otherwise the new one is added as a suppressed exception to the
current oneT - The exception typecurrent - The current exceptionextra - The extra/new exceptionThrowable.addSuppressed(Throwable)public static int hashCode(long value)
Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.