Say I have an empty list saved in a TinyDB.
ArrayList<Integer> myList = new ArrayList<Integer>();
tinyDB.StoreValue("MyList", myList);
On another screen, I want to get this TinyDB object and turn it back into an ArrayList, but I am having trouble converting it.
ArrayList<Integer> listFromScreen1 = new ArrayList<Integer>(tinyDB.GetValue("MyList"));
This throws the error The constructor ArrayList<Integer>(Object) is undefined.
ArrayList<Integer> listFromScreen1 = new ArrayList<Integer>(Convert.IntegerArrayList(tinyDB.GetValue("MyList")));
This throws the error The method IntegerArrayList(ArrayList<String>) in the type Convert is not applicable for the arguments (Object).
ArrayList<Integer> listFromScreen1 = new ArrayList<Integer>(Convert.IntegerArrayList((ArrayList<String>) tinyDB.GetValue("MyList")));
This works but warns me Type safety: Unchecked cast from Object to ArrayList<String>
So I wondered, what is the best/proper way to convert a TinyDB Object which is a list, back into a list when it has been got.
Thanks,
S