-
Notifications
You must be signed in to change notification settings - Fork 0
General Utility Routines
Ciaran O'Reilly edited this page Jun 3, 2015
·
3 revisions
A suite of static general purpose utility routines can be found in the Util class. These have been included in a single file in order to simplify usage, so that it is only necessary to enter:
Util.|
in your IDE and then select the appropriate utility routine. The routines available can be grouped as follows (representative routines listed): * Error Handling:
```java
void fatalError(...)
void fatalErrorWithoutStack(...)
```
-
I/O:
String readAll(InputStream ...) File createTempFileWithContent(...)
-
String Manipulation:
String join(...) List<String> split(...)
-
Collections:
-
Construction:
List<T> list(T... elements) List<T> mapIntoList(...) Set<T> set(T... elements) Set<T> mapIntoSet(...) Map<K, V> map(Object... keysAndValues) <K, V> V getValuePossiblyCreatingIt(Map<K, V> map, K key, Function<K, V> makerFromKey)
-
Look up and Manipulation:
void applyToAll(...) Iterator<E> find(...) boolean removeAnyTwoMatchingElements(...) Collection<T> addElementsSatisfying(...) T findAndRemoveOrNull() int collect...(...) Collection<T> setDifference(...) T min(...) T max(...)
-
-
Logic:
Boolean and(...) Boolean or(...) boolean forAll(...) boolean thereExists(...)
-
Math:
Number sum...(...) Number product...(...) Number division...(...)
Note: some of these routines overlap with Guava's capabilities and will likely delegate to or be removed completely in the future.