<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之旅 廣告
                # Kotlin 程序:將映射(`HashMap`)轉換為列表 > 原文: [https://www.programiz.com/kotlin-programming/examples/convert-map-list](https://www.programiz.com/kotlin-programming/examples/convert-map-list) #### 在此程序中,您將學習在 Kotlin 中將映射轉換為列表的不同技術。 ## 示例:將映射轉換為列表 ```kt import java.util.ArrayList import java.util.HashMap fun main(args: Array<String>) { val map = HashMap<Int, String>() map.put(1, "a") map.put(2, "b") map.put(3, "c") map.put(4, "d") map.put(5, "e") val keyList = ArrayList(map.keys) val valueList = ArrayList(map.values) println("Key List: $keyList") println("Value List: $valueList") } ``` 運行該程序時,輸出為: ```kt Key List: [1, 2, 3, 4, 5] Value List: [a, b, c, d, e] ``` 在上面的程序中,我們有一個名為`map`的整數和字符串映射。 由于`map`包含**鍵值**對,因此我們需要兩個列表來存儲它們,分別是`keyList`(用于鍵)和`valueList`(用于值)。 我們使用`map`的`keySet()`方法獲取所有鍵,并從中創建了一個`ArrayList keyList`。 同樣,我們使用`map`的`values()`方法來獲取所有值,并從中創建一個`ArrayList valueList`。 以下是等效的 Java 代碼: [Java 程序:將映射轉換為列表](/java-programming/examples/convert-map-list "Java Program to convert map to a list")。
                  <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>

                              哎呀哎呀视频在线观看