Package org.eclipse.net4j.util
Class ObjectUtil
- java.lang.Object
- 
- org.eclipse.net4j.util.ObjectUtil
 
- 
 public final class ObjectUtil extends java.lang.ObjectVarious static helper methods.- Author:
- Eike Stepper
 
- 
- 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> T[]appendtoArray(T[] array, T... elements)static java.lang.Exceptionclose(java.lang.Object object)static booleanequals(java.lang.Object o1, java.lang.Object o2)static <T> voidforEachSafe(java.lang.Iterable<T> iterable, java.util.function.Consumer<T> consumer)static <T> voidforEachSafe(T[] array, java.util.function.Consumer<T> consumer)static inthashCode(int... values)A collision-free hash code for small sets (<=4) of small, positive integers (<=128)static inthashCode(long num)static inthashCode(java.lang.Object o)static booleanisEmpty(java.lang.String string)static <T extends java.util.Collection<?>>
 booleanisEmpty(java.util.Collection<?> collection)static <T extends java.util.Map<?,?>>
 booleanisEmpty(java.util.Map<?,?> map)static <T> booleanisEmpty(T[] array)static booleannever()static <T> TnotNull(T object)static <T> TtryCast(java.lang.Object object, java.lang.Class<T> type)Attempts to cast anobjectas an instance of the giventype.
 
- 
- 
- 
Method Detail- 
neverpublic static boolean never() - Since:
- 3.6
 
 - 
equalspublic static boolean equals(java.lang.Object o1, java.lang.Object o2)
 - 
hashCodepublic static int hashCode(java.lang.Object o) 
 - 
hashCodepublic static int hashCode(int... values) A collision-free hash code for small sets (<=4) of small, positive integers (<=128)- Since:
- 3.2
 
 - 
hashCodepublic static int hashCode(long num) 
 - 
appendtoArraypublic static <T> T[] appendtoArray(T[] array, T... elements)
 - 
isEmptypublic static <T> boolean isEmpty(T[] array) - Since:
- 3.1
 
 - 
isEmptypublic static <T extends java.util.Map<?,?>> boolean isEmpty(java.util.Map<?,?> map) - Since:
- 3.1
 
 - 
isEmptypublic static <T extends java.util.Collection<?>> boolean isEmpty(java.util.Collection<?> collection) - Since:
- 3.1
 
 - 
isEmptypublic static boolean isEmpty(java.lang.String string) - Since:
- 3.1
 
 - 
closepublic static java.lang.Exception close(java.lang.Object object) - Since:
- 3.3
 
 - 
notNullpublic static <T> T notNull(T object) - Since:
- 3.3
 
 - 
tryCastpublic static <T> T tryCast(java.lang.Object object, java.lang.Class<T> type)Attempts to cast anobjectas an instance of the giventype.- Parameters:
- object- an object to cast to some- type
- type- the type to cast the- objectto
- Returns:
- the objectornullif it is not of the requiredtype
- Since:
- 3.4
 
 - 
forEachSafepublic static <T> void forEachSafe(java.lang.Iterable<T> iterable, java.util.function.Consumer<T> consumer)- Since:
- 3.13
 
 - 
forEachSafepublic static <T> void forEachSafe(T[] array, java.util.function.Consumer<T> consumer)- Since:
- 3.13
 
 
- 
 
-