public class Misc extends Object
Modifier and Type | Field and Description |
---|---|
static Iterable<?> |
emptyIterable |
static Iterator<?> |
emptyIterator |
static Object[] |
emptyObjectArray |
Constructor and Description |
---|
Misc() |
Modifier and Type | Method and Description |
---|---|
static <E> void |
addAll(Collection<E> target,
Iterable<? extends E> src) |
static <T> T[] |
appendArray(T[] base,
T... elements) |
static <T> T[] |
appendElement(T[] base,
T newElement) |
static String[] |
arrayWithoutFirst(String[] base,
int nElements) |
static <T> T[] |
arrayWithoutFirst(T[] base,
int nElements) |
static int |
clearBit(int val,
int idx) |
static int |
compare(Integer i1,
Integer i2) |
static boolean |
compare(int len,
Object[] a1,
Object[] a2)
compare first len objects of two reference arrays, which can contain null
elements.
|
static boolean |
compare(Object[] a1,
Object[] a2) |
static <T> boolean |
contains(T[] array,
Object elem) |
static <T> T |
createObject(Class<T> cls,
Class<?>[] argTypes,
Object[] args) |
static <E,T> HashMap<E,Integer> |
createOccurrenceMap(Collection<T> collection,
ElementCreator<T,E> creator) |
static <K,V> ArrayList<Map.Entry<K,V>> |
createSortedEntryList(HashMap<K,V> map,
Comparator<Map.Entry<K,V>> comparer) |
static <K,V,E> ArrayList<E> |
createSortedList(HashMap<K,V> map,
TwoTypeComparator<Map.Entry<K,V>,E> comparer,
ElementCreator<Map.Entry<K,V>,E> creator) |
static <E> Iterable<E> |
emptyIterable() |
static <E> Iterator<E> |
emptyIterator() |
static boolean |
equal(Object a,
Object b) |
static String |
fromFirst(String s,
char c) |
static <T> T[] |
getAddedElements(T[] oldArray,
T[] newArray) |
static <T,E> E |
getNextElementOfType(T[] base,
Class<E> elemType,
T prev) |
static <T> T[] |
getRemovedElements(T[] oldArray,
T[] newArray) |
static <K,V> ArrayList<String> |
getSortedKeyStrings(HashMap<K,V> map) |
static <T> boolean |
hasElementOfType(T[] base,
Class<?> elemType) |
static int |
hashCode(Object o) |
static <T> int |
indexOf(T[] array,
Object elem) |
static <E> Iterable<E> |
iterableFromIterator(Iterator<E> iter) |
static <T> T[] |
newArray(T... elements) |
static String[] |
prependArray(String[] base,
String... elements) |
static <T> T[] |
prependArray(T[] base,
T... elements) |
static <T> T[] |
removeElement(T[] base,
T element) |
static int |
setBit(int val,
int idx) |
static <T> T[] |
stripNullElements(T[] oldArray) |
static String |
stripToLastDot(String s) |
static String |
toString(int[] array,
int start,
int end,
String prefix,
String separator,
String postfix) |
static String |
toString(Iterable<?> collection,
String prefix,
String separator,
String postfix) |
static String |
toString(Object[] array,
String prefix,
String separator,
String postfix) |
static String |
upToFirst(String s,
char c) |
public static final Object[] emptyObjectArray
public static final Iterator<?> emptyIterator
public static final Iterable<?> emptyIterable
public static int hashCode(Object o)
public static <E> Iterator<E> emptyIterator()
public static <E> Iterable<E> emptyIterable()
public static <E> void addAll(Collection<E> target, Iterable<? extends E> src)
public static <T> int indexOf(T[] array, Object elem)
public static <T> boolean contains(T[] array, Object elem)
public static <T> T[] stripNullElements(T[] oldArray)
public static <T> T[] getAddedElements(T[] oldArray, T[] newArray)
public static <T> T[] getRemovedElements(T[] oldArray, T[] newArray)
public static <K,V> ArrayList<Map.Entry<K,V>> createSortedEntryList(HashMap<K,V> map, Comparator<Map.Entry<K,V>> comparer)
public static <K,V,E> ArrayList<E> createSortedList(HashMap<K,V> map, TwoTypeComparator<Map.Entry<K,V>,E> comparer, ElementCreator<Map.Entry<K,V>,E> creator)
public static <E,T> HashMap<E,Integer> createOccurrenceMap(Collection<T> collection, ElementCreator<T,E> creator)
public static String toString(Iterable<?> collection, String prefix, String separator, String postfix)
public static String toString(Object[] array, String prefix, String separator, String postfix)
public static String toString(int[] array, int start, int end, String prefix, String separator, String postfix)
public static <T> T[] newArray(T... elements)
public static <T> T[] appendArray(T[] base, T... elements)
public static <T> T[] prependArray(T[] base, T... elements)
public static <T> T[] arrayWithoutFirst(T[] base, int nElements)
public static <T> T[] appendElement(T[] base, T newElement)
public static <T> T[] removeElement(T[] base, T element)
public static <T> boolean hasElementOfType(T[] base, Class<?> elemType)
public static <T,E> E getNextElementOfType(T[] base, Class<E> elemType, T prev)
public static boolean compare(int len, Object[] a1, Object[] a2)
public static int setBit(int val, int idx)
public static int clearBit(int val, int idx)