<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之旅 廣告
                # `TreeMap Iterator`示例 - Java > 原文: [https://beginnersbook.com/2014/07/treemap-iterator-example-java/](https://beginnersbook.com/2014/07/treemap-iterator-example-java/) 在這個例子中,我們使用[`Iterator`](https://beginnersbook.com/2014/06/java-iterator-with-examples/)和[`Map.Entry`](https://beginnersbook.com/2014/06/map-entry-interface-in-java/)迭代[`TreeMap`](https://beginnersbook.com/2013/12/treemap-in-java-with-example/)。 ```java import java.util.TreeMap; import java.util.Set; import java.util.Map; import java.util.Iterator; public class TreeMapExample { public static void main(String[] args) { // Create a TreeMap TreeMap<String, String> treemap = new TreeMap<String, String>(); // Add key-value pairs to the TreeMap treemap.put("Key1","Item1"); treemap.put("Key2","Item2"); treemap.put("Key3","Item3"); treemap.put("Key4","Item4"); treemap.put("Key5","Item5"); // Get a set of the entries Set set = treemap.entrySet(); // Get an iterator Iterator it = set.iterator(); // Display elements while(it.hasNext()) { Map.Entry me = (Map.Entry)it.next(); System.out.print("Key is: "+me.getKey() + " & "); System.out.println("Value is: "+me.getValue()); } } } ``` **輸出:** ```java Key is: Key1 & Value is: Item1 Key is: Key2 & Value is: Item2 Key is: Key3 & Value is: Item3 Key is: Key4 & Value is: Item4 Key is: Key5 & Value is: Item5 ``` **參考:** [`TreeMap` javadoc](https://docs.oracle.com/javase/7/docs/api/java/util/TreeMap.html) [`Iterator` javadoc](https://docs.oracle.com/javase/7/docs/api/java/util/Iterator.html) [`Map.Entry` javadoc](https://docs.oracle.com/javase/7/docs/api/java/util/Map.Entry.html)
                  <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>

                              哎呀哎呀视频在线观看