I just want to move the transitionHash map values into the cardholderDataRecords arraylist.
HashMap<String,ExceptionLifeCycleDataBean> transitionHash = new HashMap<String,ExceptionLifeCycleDataBean>();
ArrayList<ExceptionLifeCycleDataBean> cardholderDataRecords = new ArrayList<ExceptionLifeCycleDataBean>();
i am doing as
cardholderDataRecords.add((ExceptionLifeCycleDataBean) transitionHash.values());
It’s throwing
java.lang.ClassCastException: java.util.HashMap$Values cannot be cast to com.reportss.bean.ExceptionLifeCycleDataBean
You’re trying to cast the collection of values to a single
ExceptionLifeCycleDataBean.You can very easily get the list though:
Or to add to an existing collection, with:
No casts necessary.