Java Utililty Methods Object to Array

List of utility methods to do Object to Array

  1. HOME
  2. Java
  3. O
  4. Object to Array

Description

The list of methods to do Object to Array are organized into topic(s).

Method

Object[] toArray(Object obj)
to Array
if (obj == null) {
 return new Object[0];
} else if (obj.getClass().isArray()) {
 return (Object[]) obj;
} else if (obj instanceof Collection) {
 return ((Collection<?>) obj).toArray();
return new Object[] { obj };
...
List toArray(Object obj)
to Array
if (isArray(obj)) {
 return (List<Object>) obj;
throw new IllegalArgumentException(obj + " is not an array.");
Object[] toArray(Object value)
to Array
if (value == null) {
 return EMPTY_ARRAY;
Object[] values;
if (value.getClass().isArray()) {
 values = (Object[]) value;
} else if (List.class.isInstance(value)) {
 List<Object> list = (List<Object>) value;
...

AltStyle によって変換されたページ (->オリジナル) /