Java ArrayList for integers

前端 未结 8 1181
陌清茗
陌清茗 2020-12-11 00:24

I have values that I\'d like to add into an ArrayList to keep track of what numbers have shown up. The values are integers so I created an ArrayList;

ArrayLi         


        
8条回答
  •  长情又很酷
    2020-12-11 01:10

    The [] makes no sense in the moment of making an ArrayList of Integers because I imagine you just want to add Integer values. Just use

    List list = new ArrayList<>();
    

    to create the ArrayList and it will work.

提交回复
热议问题