Package org.eclipse.net4j.util
Klasse ObjectUtil
java.lang.Object
org.eclipse.net4j.util.ObjectUtil
Various static helper methods.
- Autor:
- Eike Stepper
-
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic <T> T[]
appendtoArray
(T[] array, T... elements) static Exception
static boolean
static <T> void
forEachSafe
(Iterable<T> iterable, Consumer<T> consumer) static <T> void
forEachSafe
(T[] array, Consumer<T> consumer) static int
hashCode
(int... values) A collision-free hash code for small sets (<=4) of small, positive integers (<=128)static int
hashCode
(long num) static int
static boolean
static <T extends Collection<?>>
booleanisEmpty
(Collection<?> collection) static <T extends Map<?,
?>>
booleanstatic <T> boolean
isEmpty
(T[] array) static boolean
never()
static <T> T
notNull
(T object) static <T> T
requireNonNullElse
(T obj, T defaultObj) static <T> T
requireNonNullElseGet
(T obj, Supplier<? extends T> supplier) static int
static <T extends Collection<?>>
intsize
(Collection<?> collection) static <T extends Map<?,
?>>
intstatic <T> int
size
(T[] array) static <T> T
Attempts to cast anobject
as an instance of the giventype
.
-
Methodendetails
-
never
public static boolean never()- Seit:
- 3.6
-
equals
-
hashCode
-
hashCode
public static int hashCode(int... values) A collision-free hash code for small sets (<=4) of small, positive integers (<=128)- Seit:
- 3.2
-
hashCode
public static int hashCode(long num) -
appendtoArray
public static <T> T[] appendtoArray(T[] array, T... elements) -
isEmpty
public static <T> boolean isEmpty(T[] array) - Seit:
- 3.1
-
isEmpty
- Seit:
- 3.1
-
isEmpty
- Seit:
- 3.1
-
isEmpty
- Seit:
- 3.1
-
size
public static <T> int size(T[] array) - Seit:
- 3.26
-
size
- Seit:
- 3.26
-
size
- Seit:
- 3.26
-
size
- Seit:
- 3.26
-
close
- Seit:
- 3.3
-
notNull
public static <T> T notNull(T object) - Seit:
- 3.3
-
requireNonNullElse
public static <T> T requireNonNullElse(T obj, T defaultObj) - Seit:
- 3.28
-
requireNonNullElseGet
- Seit:
- 3.28
-
tryCast
Attempts to cast anobject
as an instance of the giventype
.- Parameter:
object
- an object to cast to sometype
type
- the type to cast theobject
to- Gibt zurück:
- the
object
ornull
if it is not of the requiredtype
- Seit:
- 3.4
-
forEachSafe
- Seit:
- 3.13
-
forEachSafe
- Seit:
- 3.13
-