array

List는 interface다. interface는 공통되는 메소드를 추출해 놓은 클래스로 생각하면 된다.

ArrayList

 

new ArrayList<Element>(Arrays.asList(array))
You can not use Java8 streams on API level < 24.
https://developer.android.com/guide/platform/j8-jack.html#configuration

 

http://stackoverflow.com/questions/13783295/getting-all-names-in-an-enum-as-a-string

In java 8, it’s one line for an arbitrary enum class using a stream:

public static String[] getNames(Class<? extends Enum<?>> e) {
    return Arrays.stream(e.getEnumConstants()).map(Enum::name).toArray(String[]::new);
}

In java 7, a bit less elegant, but this one-liner does the trick:

public static String[] names() {
    return Arrays.toString(State.values()).replaceAll("^.|.$", "").split(", ");
}

Also, here’s a version of this that will work for any enum:

public static String[] getNames(Class<? extends Enum<?>> e) {
    return Arrays.toString(e.getEnumConstants()).replaceAll("^.|.$", "").split(", ");
}

That you would call like this:

String[] names = getNames(State.class); // any other enum class will work too

https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.9