Java - get element position in array

后端 未结 4 1875
谎友^
谎友^ 2021-01-03 20:47

I\'m familiar with the ways I can get an element position in array, especially the ones showed here: Element position in array

But my problem is I can\'t figure out

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-03 21:41

    use the indexof method to get the position -

    listPackages.indexOf(current_package)
    

    http://download.oracle.com/javase/1.4.2/docs/api/java/util/ArrayList.html#indexOf(java.lang.Object)

提交回复
热议问题