<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>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # Java - 獲取`LinkedList`中元素的最后一次出現的索引 > 原文: [https://beginnersbook.com/2014/08/java-get-the-index-of-last-occurrence-of-an-element-in-linkedlist/](https://beginnersbook.com/2014/08/java-get-the-index-of-last-occurrence-of-an-element-in-linkedlist/) #### 描述 編程以找出`LinkedList`中最后一個元素出現的索引。 #### 程序 ```java import java.util.LinkedList; class LinkedListExample { public static void main(String[] args) { // create a LinkedList LinkedList<String> list = new LinkedList<String>(); // Add elements list.add("AA"); list.add("BB"); list.add("CC"); list.add("AA"); list.add("DD"); list.add("AA"); list.add("EE"); // Display LinkedList elements System.out.println("LinkedList elements: "+list); // get the index of last occurrence of element "AA" /* public int lastIndexOf(Object o): Returns the index * of the last occurrence of the specified element in * this list, or -1 if this list does not contain the * element. */ System.out.println("LastIndex of AA:"+list.lastIndexOf("AA")); // get the index of last occurrence of element "ZZ" /* Note: The element ZZ does not exist in the list so * the method lastIndexOf would return -1 for it. */ System.out.println("LastIndex of ZZ:"+list.lastIndexOf("ZZ")); } } ``` **輸出:** ```java LinkedList elements: [AA, BB, CC, AA, DD, AA, EE] LastIndex of AA:5 LastIndex of ZZ:-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>

                              哎呀哎呀视频在线观看