public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
equals(Object x,
Object y) |
static String |
escapeWhitespace(String s,
boolean escapeSpaces) |
static String |
join(Iterable<?> iter,
String separator) |
static <T> String |
join(Iterator<T> iter,
String separator) |
static <T> String |
join(T[] array,
String separator) |
static int |
numNonnull(Object[] data) |
static char[] |
readFile(String fileName) |
static char[] |
readFile(String fileName,
String encoding) |
static <T> void |
removeAll(Iterable<T> iterable,
Predicate<? super T> predicate) |
static <T> void |
removeAll(List<T> list,
Predicate<? super T> predicate) |
static <T> void |
removeAllElements(Collection<T> data,
T value) |
static char[] |
toCharArray(IntegerList data)
Convert the list to a UTF-16 encoded char array.
|
static Map<String,Integer> |
toMap(String[] keys)
Convert array of strings to string→index map.
|
static IntervalSet |
toSet(BitSet bits) |
static void |
writeFile(File file,
byte[] content) |
static void |
writeFile(String fileName,
String content) |
static void |
writeFile(String fileName,
String content,
String encoding) |
public static int numNonnull(Object[] data)
public static <T> void removeAllElements(Collection<T> data, T value)
public static void writeFile(@NotNull
File file,
@NotNull
byte[] content)
throws IOException
IOExceptionpublic static void writeFile(@NotNull
String fileName,
@NotNull
String content)
throws IOException
IOExceptionpublic static void writeFile(@NotNull
String fileName,
@NotNull
String content,
@Nullable
String encoding)
throws IOException
IOException@NotNull
public static char[] readFile(@NotNull
String fileName)
throws IOException
IOException@NotNull
public static char[] readFile(@NotNull
String fileName,
@Nullable
String encoding)
throws IOException
IOExceptionpublic static <T> void removeAll(@NotNull
List<T> list,
@NotNull
Predicate<? super T> predicate)
public static <T> void removeAll(@NotNull
Iterable<T> iterable,
@NotNull
Predicate<? super T> predicate)
public static Map<String,Integer> toMap(String[] keys)
public static char[] toCharArray(IntegerList data)
@NotNull public static IntervalSet toSet(@NotNull BitSet bits)
Copyright © 1992–2024 Daniel Sun. All rights reserved.