Add object to ArrayList at specified index

前端 未结 14 1426
南笙
南笙 2020-11-30 18:59

I think it\'s a fairly simple question, but I can\'t figure out how to do this properly.

I\'ve got an empty arraylist:

ArrayList list =         


        
      
      
      
14条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 19:32

    This is a possible solution:

    list.add(list.size(), new Object());
    

提交回复
热议问题