Converting HashMap to ArrayList

后端 未结 2 1654
忘了有多久
忘了有多久 2020-12-29 01:20

I just want to move the transitionHash map values into the cardholderDataRecords arraylist.

HashMap transitionHash =         


        
相关标签:
2条回答
  • 2020-12-29 01:45

    Converting Data HashSet to Array List

    ArrayList<ExceptionLifeCycleDataBean> cardholderDataRecords = new ArrayList<ExceptionLifeCycleDataBean>(transitionHash);
    

    Same Way, You can convert ArrayList to Hashmap.

    0 讨论(0)
  • 2020-12-29 01:54

    You're trying to cast the collection of values to a single ExceptionLifeCycleDataBean.

    You can very easily get the list though:

    List<ExceptionLifeCycleDataBean> beans =
        new ArrayList<ExceptionLifeCycleDataBean>(transitionHash.values());
    

    Or to add to an existing collection, with:

    cardholderDataRecords.addAll(transitionHash.values());
    

    No casts necessary.

    0 讨论(0)
提交回复
热议问题