Is there a more elegant solution to convert an ‘Arraylist‘ into a ‘Arraylist<Type>‘?
Current code:
ArrayList productsArrayList=getProductsList();
ArrayList<ProductListBean> productList = new ArrayList<ProductListBean>();
for (Object item : productsArrayList)
{
ProductListBean product = (ProductListBean)item;
productList.add(product);
}
Note that this is inherently unsafe, so it should only be used if getProductsList can’t be updated.