public class U extends Object
| Constructor and Description |
|---|
U() |
| Modifier and Type | Method and Description |
|---|---|
static void |
argMust(boolean expectedCondition,
String message,
Object... args) |
static Object[] |
array(Iterable<?> items) |
static <T> T[] |
array(T... items) |
static <T> void |
assign(Collection<T> destination,
Collection<? extends T> source) |
static <K,V> void |
assign(Map<K,V> destination,
Map<? extends K,? extends V> source) |
static <K,V> Map<K,V> |
autoExpandingMap(Class<?> clazz) |
static <K,V> Map<K,V> |
autoExpandingMap(Mapper<K,V> valueFactory) |
static int |
bounded(int min,
int value,
int max) |
static void |
bounds(int value,
int min,
int max) |
static String |
capitalized(String s) |
static <T> T |
cast(Object value)
Simpler casts, less warnings.
|
static <T> int |
compare(T val1,
T val2) |
static CompiledScript |
compileJS(String js) |
static <K,V> ConcurrentMap<K,V> |
concurrentMap() |
static <K,V> ConcurrentMap<K,V> |
concurrentMap(K key,
V value) |
static <K,V> ConcurrentMap<K,V> |
concurrentMap(K key1,
V value1,
K key2,
V value2) |
static <K,V> ConcurrentMap<K,V> |
concurrentMap(K key1,
V value1,
K key2,
V value2,
K key3,
V value3) |
static <K,V> ConcurrentMap<K,V> |
concurrentMap(K key1,
V value1,
K key2,
V value2,
K key3,
V value3,
K key4,
V value4) |
static <K,V> ConcurrentMap<K,V> |
concurrentMap(K key1,
V value1,
K key2,
V value2,
K key3,
V value3,
K key4,
V value4,
K key5,
V value5) |
static <K,V> ConcurrentMap<K,V> |
concurrentMap(Map<? extends K,? extends V> src,
boolean ignoreNullValues) |
static <K,V> ConcurrentMap<K,V> |
concurrentMap(Object... keysAndValues) |
static <T> T |
dynamic(Class<T> targetInterface,
Dynamic dynamic) |
static boolean |
eq(Object a,
Object b) |
static <T> T |
evalJS(String js) |
static <T> T |
evalJS(String js,
Map<String,?> bindings) |
static boolean |
exists(Callable<?> accessChain) |
static <T> T |
first(List<T> values) |
static <T> T |
first(T[] values) |
static String |
frmt(String format,
Object... args) |
static <K,V> V |
get(Map<K,V> map,
K key) |
static <K,V> V |
get(Map<K,V> map,
K key,
V defaultValue) |
static IllegalArgumentException |
illegalArg(String message,
Object... args) |
static String |
insert(String target,
int atIndex,
String insertion) |
static <T> Is<T> |
is(T value) |
static boolean |
isCollection(Object obj) |
static boolean |
isEmpty(Collection<?> coll) |
static boolean |
isEmpty(Iterable<?> iter) |
static boolean |
isEmpty(Map<?,?> map) |
static boolean |
isEmpty(Object value) |
static boolean |
isEmpty(Object[] arr) |
static boolean |
isEmpty(String value) |
static <T> boolean |
isIn(T value,
T... candidates) |
static boolean |
isList(Object obj) |
static boolean |
isMap(Object obj) |
static boolean |
isSet(Object obj) |
static <T> Iterator<T> |
iterator(T[] arr) |
static String |
join(String sep,
char[][] items) |
static String |
join(String sep,
Iterable<?> items) |
static <T> String |
join(String sep,
T... items) |
static <T> T |
last(List<T> values) |
static <T> T |
last(T[] values) |
static <T> List<T> |
list() |
static <T> List<T> |
list(Iterable<? extends T> values) |
static <T> List<T> |
list(T... values) |
static <K,V> Map<K,V> |
map() |
static <K,V> Map<K,V> |
map(K key,
V value) |
static <K,V> Map<K,V> |
map(K key1,
V value1,
K key2,
V value2) |
static <K,V> Map<K,V> |
map(K key1,
V value1,
K key2,
V value2,
K key3,
V value3) |
static <K,V> Map<K,V> |
map(K key1,
V value1,
K key2,
V value2,
K key3,
V value3,
K key4,
V value4) |
static <K,V> Map<K,V> |
map(K key1,
V value1,
K key2,
V value2,
K key3,
V value3,
K key4,
V value4,
K key5,
V value5) |
static <K,V> Map<K,V> |
map(Map<? extends K,? extends V> src) |
static <K,V> Map<K,V> |
map(Object... keysAndValues) |
static <K,V> Map<K,List<V>> |
mapOfLists() |
static <K1,K2,V> Map<K1,Map<K2,V>> |
mapOfMaps() |
static <K,V> Map<K,Set<V>> |
mapOfSets() |
static String |
mid(String s,
int beginIndex,
int endIndex) |
static String |
mul(String s,
int n) |
static boolean |
must(boolean expectedCondition) |
static boolean |
must(boolean expectedCondition,
String message) |
static boolean |
must(boolean expectedCondition,
String message,
long arg) |
static boolean |
must(boolean expectedCondition,
String message,
Object arg) |
static boolean |
must(boolean expectedCondition,
String message,
Object arg1,
Object arg2) |
static boolean |
must(boolean expectedCondition,
String message,
Object arg1,
Object arg2,
Object arg3) |
static boolean |
notEmpty(Collection<?> coll) |
static boolean |
notEmpty(Iterable<?> iter) |
static boolean |
notEmpty(Map<?,?> map) |
static boolean |
notEmpty(Object value) |
static boolean |
notEmpty(Object[] arr) |
static boolean |
notEmpty(String value) |
static RuntimeException |
notExpected() |
static <T> T |
notNull(T value,
String msgOrDesc,
Object... descArgs) |
static RuntimeException |
notReady() |
static RuntimeException |
notSupported() |
static int |
num(String s) |
static <T> T |
or(T value,
T fallback) |
static <K,V> Map<K,V> |
orderedMap() |
static <K,V> Map<K,V> |
orderedMap(K key,
V value) |
static <K,V> Map<K,V> |
orderedMap(K key1,
V value1,
K key2,
V value2) |
static <K,V> Map<K,V> |
orderedMap(K key1,
V value1,
K key2,
V value2,
K key3,
V value3) |
static <K,V> Map<K,V> |
orderedMap(K key1,
V value1,
K key2,
V value2,
K key3,
V value3,
K key4,
V value4) |
static <K,V> Map<K,V> |
orderedMap(K key1,
V value1,
K key2,
V value2,
K key3,
V value3,
K key4,
V value4,
K key5,
V value5) |
static <K,V> Map<K,V> |
orderedMap(Map<? extends K,? extends V> src,
boolean ignoreNullValues) |
static <K,V> Map<K,V> |
orderedMap(Object... keysAndValues) |
static <T> List<T> |
page(Iterable<T> items,
int page,
int pageSize) |
static String |
path(String... parts) |
static void |
print(Object... values) |
static <T> Queue<T> |
queue() |
static <T> BlockingQueue<T> |
queue(int maxSize) |
static <T> List<T> |
range(Iterable<T> items,
int fromIndex,
int toIndex) |
static String |
render(Iterable<?> items,
String itemFormat,
String sep) |
static String |
render(Object[] items,
String itemFormat,
String sep) |
static String |
replace(String s,
String[][] repls) |
static String |
replace(String s,
String regex,
Mapper<String[],String> replacer) |
static RuntimeException |
rte(String message) |
static RuntimeException |
rte(String message,
Object... args) |
static RuntimeException |
rte(String message,
Throwable cause) |
static RuntimeException |
rte(String message,
Throwable cause,
Object... args) |
static RuntimeException |
rte(Throwable cause) |
static void |
rteIf(boolean failureCondition,
String msg) |
static boolean |
safe(Boolean b) |
static byte |
safe(Byte num) |
static double |
safe(Double num) |
static float |
safe(Float num) |
static int |
safe(Integer num) |
static <T> List<T> |
safe(List<T> list) |
static long |
safe(Long num) |
static <K,V> Map<K,V> |
safe(Map<K,V> map) |
static Object[] |
safe(Object[] arr) |
static <T> Set<T> |
safe(Set<T> set) |
static String |
safe(String s) |
static void |
secure(boolean condition,
String msg) |
static void |
secure(boolean condition,
String msg,
Object arg) |
static void |
secure(boolean condition,
String msg,
Object arg1,
Object arg2) |
static <T> Set<T> |
set() |
static <T> Set<T> |
set(Iterable<? extends T> values) |
static <T> Set<T> |
set(T... values) |
static <T> T |
single(Iterable<T> coll) |
static <T> T |
singleOrNone(Iterable<T> coll) |
static void |
sleep(long millis)
Sleeps (calling Thread.sleep) for the specified period.
|
static String |
str(Iterable<Object> coll) |
static String |
str(Iterator<?> it) |
static String |
str(Object obj) |
static String |
str(Object[] objs) |
static <T> List<T> |
synchronizedList() |
static <K,V> Map<K,V> |
synchronizedMap() |
static <T> Set<T> |
synchronizedSet() |
static long |
time() |
static String |
triml(String s,
char prefix) |
static String |
triml(String s,
String prefix) |
static String |
trimr(String s,
char suffix) |
static String |
trimr(String s,
String suffix) |
static String |
uncapitalized(String s) |
static String |
uri(String... parts) |
static void |
wait(CountDownLatch latch) |
static void |
wait(CountDownLatch latch,
long timeout,
TimeUnit unit) |
static boolean |
xor(boolean a,
boolean b) |
public static void print(Object... values)
public static <T> Iterator<T> iterator(T[] arr)
public static <T> T[] array(T... items)
public static <T> Set<T> synchronizedSet()
public static <T> Set<T> set()
public static <T> Set<T> set(T... values)
public static <T> List<T> synchronizedList()
public static <T> List<T> list()
public static <T> List<T> list(T... values)
public static <K,V> Map<K,V> map()
public static <K,V> Map<K,V> map(K key, V value)
public static <K,V> Map<K,V> map(K key1, V value1, K key2, V value2)
public static <K,V> Map<K,V> map(K key1, V value1, K key2, V value2, K key3, V value3)
public static <K,V> Map<K,V> map(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4)
public static <K,V> Map<K,V> map(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4, K key5, V value5)
public static <K,V> ConcurrentMap<K,V> concurrentMap()
public static <K,V> ConcurrentMap<K,V> concurrentMap(Map<? extends K,? extends V> src, boolean ignoreNullValues)
public static <K,V> ConcurrentMap<K,V> concurrentMap(K key, V value)
public static <K,V> ConcurrentMap<K,V> concurrentMap(K key1, V value1, K key2, V value2)
public static <K,V> ConcurrentMap<K,V> concurrentMap(K key1, V value1, K key2, V value2, K key3, V value3)
public static <K,V> ConcurrentMap<K,V> concurrentMap(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4)
public static <K,V> ConcurrentMap<K,V> concurrentMap(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4, K key5, V value5)
public static <K,V> ConcurrentMap<K,V> concurrentMap(Object... keysAndValues)
public static <K,V> Map<K,V> orderedMap()
public static <K,V> Map<K,V> orderedMap(Map<? extends K,? extends V> src, boolean ignoreNullValues)
public static <K,V> Map<K,V> orderedMap(K key, V value)
public static <K,V> Map<K,V> orderedMap(K key1, V value1, K key2, V value2)
public static <K,V> Map<K,V> orderedMap(K key1, V value1, K key2, V value2, K key3, V value3)
public static <K,V> Map<K,V> orderedMap(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4)
public static <K,V> Map<K,V> orderedMap(K key1, V value1, K key2, V value2, K key3, V value3, K key4, V value4, K key5, V value5)
public static <K,V> Map<K,V> synchronizedMap()
public static <T> Queue<T> queue()
public static <T> BlockingQueue<T> queue(int maxSize)
public static <T> T or(T value,
T fallback)
public static boolean safe(Boolean b)
public static int safe(Integer num)
public static long safe(Long num)
public static byte safe(Byte num)
public static float safe(Float num)
public static double safe(Double num)
public static long time()
public static boolean xor(boolean a,
boolean b)
public static RuntimeException rte(String message)
public static RuntimeException rte(String message, Throwable cause)
public static RuntimeException rte(Throwable cause)
public static RuntimeException rte(String message, Object... args)
public static RuntimeException notExpected()
public static RuntimeException notReady()
public static RuntimeException notSupported()
public static void rteIf(boolean failureCondition,
String msg)
public static boolean must(boolean expectedCondition,
String message)
public static RuntimeException rte(String message, Throwable cause, Object... args)
public static boolean must(boolean expectedCondition)
public static boolean must(boolean expectedCondition,
String message,
long arg)
public static boolean must(boolean expectedCondition,
String message,
Object arg1,
Object arg2)
public static boolean must(boolean expectedCondition,
String message,
Object arg1,
Object arg2,
Object arg3)
public static IllegalArgumentException illegalArg(String message, Object... args)
public static void secure(boolean condition,
String msg)
public static void bounds(int value,
int min,
int max)
public static boolean isEmpty(String value)
public static boolean isEmpty(Object[] arr)
public static boolean isEmpty(Collection<?> coll)
public static boolean isEmpty(Iterable<?> iter)
public static boolean isEmpty(Map<?,?> map)
public static boolean isEmpty(Object value)
public static boolean notEmpty(String value)
public static boolean notEmpty(Object[] arr)
public static boolean notEmpty(Collection<?> coll)
public static boolean notEmpty(Iterable<?> iter)
public static boolean notEmpty(Map<?,?> map)
public static boolean notEmpty(Object value)
public static int num(String s)
public static int bounded(int min,
int value,
int max)
public static <T> T single(Iterable<T> coll)
public static <T> T singleOrNone(Iterable<T> coll)
public static <T> T first(T[] values)
public static <T> T first(List<T> values)
public static <T> T last(T[] values)
public static <T> T last(List<T> values)
public static <T> int compare(T val1,
T val2)
public static void sleep(long millis)
CancellationException to propagate the interruption.millis - the length of time to sleep in milliseconds.public static <T> T cast(Object value)
public static void wait(CountDownLatch latch)
public static void wait(CountDownLatch latch, long timeout, TimeUnit unit)
public static <T> T evalJS(String js) throws ScriptException
ScriptExceptionpublic static <T> T evalJS(String js, Map<String,?> bindings) throws ScriptException
ScriptExceptionpublic static CompiledScript compileJS(String js) throws ScriptException
ScriptExceptionpublic static <T> boolean isIn(T value,
T... candidates)
public static <T> Is<T> is(T value)
public static boolean exists(Callable<?> accessChain)
public static boolean isMap(Object obj)
public static boolean isList(Object obj)
public static boolean isSet(Object obj)
public static boolean isCollection(Object obj)
public static <T> void assign(Collection<T> destination, Collection<? extends T> source)
public static <K,V> V get(Map<K,V> map, K key)
public static <K,V> V get(Map<K,V> map, K key, V defaultValue)
Copyright © 2014–2015 Nikolche Mihajlovski and contributors. All rights reserved.