public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static String |
assertNonEmpty(String string) |
static <T extends Number> |
assertNonNegative(T number) |
static <T> T |
assertNotNull(T o) |
static <T extends Number> |
assertPositive(T number) |
static String |
camelCaseToScreaming(String input) |
static String |
capitalize(String s)
Capitalizes the first character in the string.
|
static String |
decapitalize(String s)
Lower-cases the first character in the string.
|
static String |
escapeEndOfLines(String string) |
static boolean |
hasUnaryMinusAsParent(Node n)
Checks, if the parent is a unary expression with a minus operator.
|
static StringBuilder |
indent(StringBuilder builder,
int indentLevel)
Make an indent by appending indentLevel tab characters to the builder.
|
static <E> int |
indexOfElementByObjectIdentity(List<E> list,
E o)
Like
List.indexOf(Object), but using ==, not equals. |
static <E> boolean |
isNullOrEmpty(Collection<E> collection) |
static String |
nextWord(String string)
Return the next word of the string, in other words it stops when a space is encountered.
|
static String |
normalizeEolInTextBlock(String content,
LineSeparator desiredEndOfLineCharacter) |
static String |
normalizeEolInTextBlock(String content,
String desiredEndOfLineCharacter) |
static String |
readerToString(Reader reader) |
static <E> void |
removeElementByObjectIdentity(List<E> list,
E o)
Like
List.remove(Object), but using ==, not equals. |
static String |
removeFileExtension(String filename) |
static <E> void |
replaceElementByObjectIdentity(List<E> list,
E oldObject,
E newObject)
Like
List.set(int, Object) at List.indexOf(Object), but using ==, not equals. |
static String |
screamingToCamelCase(String original)
Transform a string to the camel case conversion.
|
static <T> Set<T> |
set(T... items) |
static String |
toCamelCase(String original)
Deprecated.
use screamingToCamelCase
|
static String |
trimTrailingSpaces(String line)
Like
String.trim(), but only the trailing spaces. |
static boolean |
valueIsNullOrEmpty(Object value) |
static boolean |
valueIsNullOrEmptyStringOrOptional(Object value) |
public static <E> boolean isNullOrEmpty(Collection<E> collection)
public static <T> T assertNotNull(T o)
public static <T extends Number> T assertNonNegative(T number)
public static <T extends Number> T assertPositive(T number)
public static String escapeEndOfLines(String string)
public static String readerToString(Reader reader) throws IOException
IOException@Deprecated public static String toCamelCase(String original)
public static String screamingToCamelCase(String original)
For example "ABC_DEF" becomes "abcDef"
public static String camelCaseToScreaming(String input)
input - "aCamelCaseString"public static String nextWord(String string)
public static StringBuilder indent(StringBuilder builder, int indentLevel)
public static String decapitalize(String s)
public static boolean valueIsNullOrEmpty(Object value)
public static boolean valueIsNullOrEmptyStringOrOptional(Object value)
public static <E> void replaceElementByObjectIdentity(List<E> list, E oldObject, E newObject)
List.set(int, Object) at List.indexOf(Object), but using ==, not equals.public static <E> void removeElementByObjectIdentity(List<E> list, E o)
List.remove(Object), but using ==, not equals.public static <E> int indexOfElementByObjectIdentity(List<E> list, E o)
List.indexOf(Object), but using ==, not equals.@SafeVarargs public static <T> Set<T> set(T... items)
public static String normalizeEolInTextBlock(String content, String desiredEndOfLineCharacter)
public static String normalizeEolInTextBlock(String content, LineSeparator desiredEndOfLineCharacter)
public static String removeFileExtension(String filename)
public static String trimTrailingSpaces(String line)
String.trim(), but only the trailing spaces.public static boolean hasUnaryMinusAsParent(Node n)
Copyright © 2007–2025. All rights reserved.