I have a situation in which I am getting data from database, and I want to upcast it to ArrayList of objects
and then downcast it to different custom ArrayList i.e. List<User>
, List<Groups>
etc.
My question is up-casting to object and then down-casting to ArrayList, what will be the cost, and is it efficient or good practice.
EDITED
Instead of getting data as List<User>, List<Groups>
etc I want to get data as ArrayList<objetcs>
once and then as per my need, I will downcast data to ArrayList<User>,
ArrayList<Groups>
later on.