public class Utils extends Object
| Constructor and Description |
|---|
Utils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
compare(byte x,
byte y) |
static int |
compare(double d1,
double d2) |
static int |
compare(float f1,
float f2) |
static int |
compare(int x,
int y) |
static int |
compare(long x,
long y) |
static int |
compare(Object a,
Object b) |
static int |
compare(Object a,
Object b,
Comparator c) |
static boolean[] |
copyOf(boolean[] original,
int newLength)
Copies the specified array, truncating or padding with false (if
necessary) so the copy has the specified length.
|
static char[] |
copyOf(char[] original,
int newLength)
Copies the specified array, truncating or padding with null characters
(if necessary) so the copy has the specified length.
|
static double[] |
copyOf(double[] original,
int newLength)
Copies the specified array, truncating or padding with zeros (if
necessary) so the copy has the specified length.
|
static float[] |
copyOf(float[] original,
int newLength)
Copies the specified array, truncating or padding with zeros (if
necessary) so the copy has the specified length.
|
static int[] |
copyOf(int[] original,
int newLength)
Copies the specified array, truncating or padding with zeros (if
necessary) so the copy has the specified length.
|
static long[] |
copyOf(long[] original,
int newLength)
Copies the specified array, truncating or padding with zeros (if
necessary) so the copy has the specified length.
|
static short[] |
copyOf(short[] original,
int newLength) |
static <T> T[] |
copyOf(T[] original,
int newLength) |
static <T,U> T[] |
copyOf(U[] original,
int newLength,
Class<? extends T[]> newType) |
static Object |
copyOfArray(Object array) |
static int |
fibonacci(int number) |
static int |
hashCode(Object o) |
static <T,V> V |
ifType(Object object,
Class<T> type,
Function<T,V> r) |
static long |
inUseMemory() |
static boolean |
isEmpty(Object object) |
static Object |
joinArrays(Object... arrays) |
static Object |
joinArraysAsType(Class componentType,
Object... arrays) |
static long |
maxFreeMemory() |
static <T> T |
ncast(Class<T> type,
Object object) |
static <T> void |
ncastDo(Class<T> type,
Object object,
DoWith<T> r) |
static Object |
nonEmptyValue(Object... objects) |
static Object |
nonNullValue(Object... objects) |
static <T> T |
rand(Class<T> enumType) |
static int |
rand(int min,
int max) |
static <T> T |
rand(List<T> values) |
static <T> T |
rand(T[] values) |
static Object |
removeArray(Object array,
int offset,
int removeCount) |
static Object |
removeArrayTail(Object array,
int offset,
int removeCount) |
static <T,V> List<T> |
sort(List<T> list,
Function<T,V> converter,
Comparator<V> c) |
static <T,V> T[] |
sort(T[] arr,
Function<T,V> converter,
Comparator<V> c) |
public static int compare(Object a, Object b, Comparator c)
public static boolean isEmpty(Object object)
public static int fibonacci(int number)
public static int rand(int min,
int max)
public static <T> T rand(List<T> values)
public static <T> T rand(T[] values)
public static <T> T rand(Class<T> enumType)
public static long inUseMemory()
public static long maxFreeMemory()
public static int compare(byte x,
byte y)
public static int compare(int x,
int y)
public static int compare(long x,
long y)
public static int compare(double d1,
double d2)
public static int compare(float f1,
float f2)
public static int hashCode(Object o)
public static <T> T[] copyOf(T[] original,
int newLength)
public static <T,U> T[] copyOf(U[] original,
int newLength,
Class<? extends T[]> newType)
public static short[] copyOf(short[] original,
int newLength)
public static int[] copyOf(int[] original,
int newLength)
original - the array to be copiednewLength - the length of the copy to be returnedNegativeArraySizeException - if newLength is negativeNullPointerException - if original is nullpublic static long[] copyOf(long[] original,
int newLength)
original - the array to be copiednewLength - the length of the copy to be returnedNegativeArraySizeException - if newLength is negativeNullPointerException - if original is nullpublic static char[] copyOf(char[] original,
int newLength)
original - the array to be copiednewLength - the length of the copy to be returnedNegativeArraySizeException - if newLength is negativeNullPointerException - if original is nullpublic static float[] copyOf(float[] original,
int newLength)
original - the array to be copiednewLength - the length of the copy to be returnedNegativeArraySizeException - if newLength is negativeNullPointerException - if original is nullpublic static double[] copyOf(double[] original,
int newLength)
original - the array to be copiednewLength - the length of the copy to be returnedNegativeArraySizeException - if newLength is negativeNullPointerException - if original is nullpublic static boolean[] copyOf(boolean[] original,
int newLength)
original - the array to be copiednewLength - the length of the copy to be returnedNegativeArraySizeException - if newLength is negativeNullPointerException - if original is nullpublic static <T,V> List<T> sort(List<T> list, Function<T,V> converter, Comparator<V> c)
public static <T,V> T[] sort(T[] arr,
Function<T,V> converter,
Comparator<V> c)
Copyright © 2021 vpc open source initiative. All rights reserved.