<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 - 檢查`LinkedList`中是否存在特定元素 > 原文: [https://beginnersbook.com/2014/07/java-check-if-a-particular-element-exists-in-linkedlist-example/](https://beginnersbook.com/2014/07/java-check-if-a-particular-element-exists-in-linkedlist-example/) 在這個例子中,我們將看到如何使用[`contains()`方法](https://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html#contains(java.lang.Object))檢查[`LinkedList`](https://beginnersbook.com/2013/12/linkedlist-in-java-with-example/)中是否存在特定元素: `public boolean contains(Object o)`:如果此列表包含指定的元素,則返回`true`。更正式地,當且僅當此列表包含至少一個元素`e`時才返回`true`(`o == null? e == null: o.equals(e)`)。 ```java import java.util.LinkedList; public class CheckLinkedList { public static void main(String[] args) { // Creating LinkedList of String Elements LinkedList<String> linkedlist = new LinkedList<String>(); // Populating it with String values linkedlist.add("AA"); linkedlist.add("BB"); linkedlist.add("CC"); linkedlist.add("DD"); linkedlist.add("EE"); // contains() method checks whether the element exists if (linkedlist.contains("CC")) { System.out.println("Element CC is present in List"); } else { System.out.println("List doesn't have element CC"); } //Checking for element FF if (linkedlist.contains("FF")) { System.out.println("Element FF is present in List"); } else { System.out.println("List doesn't have element FF"); } } } ``` 輸出: ```java Element CC is present in List List doesn't have element FF ```
                  <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>

                              哎呀哎呀视频在线观看