I need to know the runtime class of Arrays.asList()
.
So when i do this:
List<String> list = Arrays.asList("one", "two");
logger.info(list.getClass()); // ==> class java.util.Arrays$ArrayList
The log shows: class java.util.Arrays$ArrayList .
Some search for, java.util.Arrays$ArrayList:
is a nested class inside the Arrays class that implements the List interface. This implementation has a fixed length and is backed by an array.
But i do not find the runtime class of it, to do this alt when for exemple: List args = Arrays.asList("one", "two")
public Object register(Object args) {
if(args.getClass().equals(java.util.Arrays.class)) {
//do something
// don't work
return "";
}
if(args.getClass().equals(ArrayList.class)) {
//do something
// don't work
return "";
}
//other Alt statement code
return "";
}
I have no idea how to do the comparaison.