Let's say i have an array encapsulated in an object :
String[] strvls = { "Alessio", "Ale" };
Object container = strvls;
I want to extract back the array from the container object, how can i do ?
I know that is an array checking in this way :
if(container.getClass().isArray()) {
//Extract the encapsulated array - How ?
}
I can't cast into a String array, because I can't know for sure that the type of the array was String[]
... So i need to cast into a generic type array, Is it possible in Java ?