public class Static extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> List<T> |
asList(Iterable<T> iterable)
Converts the given iterable to a
List. |
static <T extends Comparable<T>> |
compare(T left,
T right)
Compares the two given objects, handling
null values predictably. |
static boolean |
equal(Object thisObject,
Object thatObject)
Compares two objects.
|
static long |
gcd(long a,
long b) |
static Class<?> |
getLoggingClass(Object object)
Returns the class that can be used to derive the logger name from.
|
static String |
join(String separator,
String[] parts)
Joins an array of strings together using a given separator
|
static <T> T[] |
newArrayInstance(Class<T> baseClass,
int length)
Creates a new array instance in a type safe way.
|
static <T> T[] |
newArrayInstance(T[] template,
int length)
Creates a new array instance in a type safe way.
|
static <T> Iterable<T> |
notNull(Iterable<T> iterable)
Returns the given iterable, or an empty iterable if
null is given. |
static <T> T[] |
offer(T head,
T[] tail)
Creates a copy of an array with a single item prepended to it.
|
static <T> T[] |
offerArray(T[] prepend,
T[] tail)
Creates a copy of an array with another array prepended to it.
|
static <T> List<T> |
toList(TypedIterable<T> iterable)
Converts the given iterable to a
List. |
public static <T> Iterable<T> notNull(Iterable<T> iterable)
null is given.T - The base type of the iterableiterable - The iterablenull is givenpublic static <T> List<T> asList(Iterable<T> iterable)
List. Note: traversing the iterable may destroy the original.T - The base type of the iterableiterable - The iterablepublic static <T extends Comparable<T>> int compare(T left, T right)
null values predictably. A null value is
compared smaller than a non-null value. See Comparable.compareTo(Object) for
the definition of the return value.T - The type of both objects, extends Comparableleft - The left objectright - The right objectleft is smaller than, greater than or equal to rightpublic static <T> T[] offer(T head,
@NotNull
T[] tail)
T - The base type of the arrayhead - The item to prependtail - The original arraypublic static <T> T[] offerArray(T[] prepend,
T[] tail)
T - The base type of the arrayprepend - The array to prependtail - The original arraypublic static <T> T[] newArrayInstance(T[] template,
int length)
T - The base type of the new arraytemplate - The original arraylength - The length of the new arraypublic static <T> T[] newArrayInstance(Class<T> baseClass, int length)
T - The base type of the new arraybaseClass - The type of the elements of the arraylength - The length of the new arraypublic static boolean equal(Object thisObject, Object thatObject)
null values.thisObject - One objectthatObject - Other objecttrue if the one object equals the other object; false otherwisepublic static Class<?> getLoggingClass(Object object)
object - The object to querypublic static String join(String separator, String[] parts)
separator - The separator to useparts - An array of stringspublic static <T> List<T> toList(TypedIterable<T> iterable)
List. Note: traversing the iterable may destroy the original.T - The base type of the iterableiterable - The iterablepublic static long gcd(long a,
long b)
Copyright © 2014. All rights reserved.