I have a method which converts the Object ( which is an array of primitive or strings) which i have got after invocation of a method (so its in instance of java.lang.Object). I want to build the ArrayList from the input array. I tried using new ArrayList
I have coded something like this
private List<String> getListOfStringForPrimitives( Object inputObject ) {
Class<?> inputClass = null;
if (inputObject != null) {
inputClass = inputObject.getClass();
// Returns true if the inputObject is an Array
if (isTypeAnArray(inputClass.getName())) {
Class<?> componentType = inputClass.getComponentType();
// If the inputObject is array of primitives build the list of Strings from the inputObject
if (isTypePrimitive(componentType.getName())) {
//ArrayList <String> arryList;
// build an array list of Strings. from the inputObject and return.
}
}
}
return arryList;
}
I am stuck how to build the ArrayList from input array! Thanks in advance.