Arraylist - Set/ add method usage - Java

后端 未结 7 1343
渐次进展
渐次进展 2021-01-14 06:03

I have an Arraylist of integers. My requirement is to determine if the arraylist HAS an element existing at the specified index.If YES, then a value should be set to that in

7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-14 06:28

    What you want is a Map rather than a List.

    What if counter is way bigger then List.size()? Do you add as many elements as needed in between?

提交回复
热议问题