<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # Java`ArrayList lastIndexOf(Object Obj)`方法 > 原文: [https://beginnersbook.com/2013/12/java-arraylist-lastindexofobject-0bj-method-example/](https://beginnersbook.com/2013/12/java-arraylist-lastindexofobject-0bj-method-example/) 方法`lastIndexOf(Object obj)`返回`ArrayList`中指定元素的最后一次出現的索引。如果列表中不存在指定的元素,則返回 -1。 `public int lastIndexOf(Object obj)` 這將返回`ArrayList`中元素`Obj`的最后一次出現的索引。 ### 例 在下面的示例中,我們有一個`Integer ArrayList`,它具有很少的重復元素。我們使用`lastIndexof` 方法獲取少數元素的最后一個索引。 ```java package beginnersbook.com; import java.util.ArrayList; public class LastIndexOfExample { public static void main(String args[]) { //ArrayList of Integer Type ArrayList<Integer> al = new ArrayList<Integer>(); al.add(1); al.add(88); al.add(9); al.add(17); al.add(17); al.add(9); al.add(17); al.add(91); al.add(27); al.add(1); al.add(17); System.out.println("Last occurrence of element 1: "+al.lastIndexOf(1)); System.out.println("Last occurrence of element 9: "+al.lastIndexOf(9)); System.out.println("Last occurrence of element 17: "+al.lastIndexOf(17)); System.out.println("Last occurrence of element 91: "+al.lastIndexOf(91)); System.out.println("Last occurrence of element 88: "+al.lastIndexOf(88)); } } ``` 輸出: ```java Last occurrence of element 1: 9 Last occurrence of element 9: 5 Last occurrence of element 17: 10 Last occurrence of element 91: 7 Last occurrence of element 88: 1 ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看