<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 功能強大 支持多語言、二開方便! 廣告
                # 將一個`Vector`的所有元素復制到另一個`Vector` > 原文: [https://beginnersbook.com/2013/12/copy-all-the-elements-of-one-vector-to-another-vector-example/](https://beginnersbook.com/2013/12/copy-all-the-elements-of-one-vector-to-another-vector-example/) 在這個例子中,我們將看到如何將`Vector`的所有元素復制到另一個`Vector`。該過程用第一向量的對應元素替換第二向量的現有元素。對于例如如果我們將向量`v1`復制到向量`v2`,那么`v2`的第一個元素將被`v1`的第一個元素替換,依此類推。 在下面的代碼中,我們有兩個向量`va`和`vb`和我們正在使用[`Collections.copy()`](https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#copy(java.util.List, java.util.List))方法將`va`的所有元素復制到`vb`。 ### 例: ```java import java.util.Collections; import java.util.Vector; public class VectorCopyExample { public static void main(String args[]) { //First Vector of String type Vector<String> va = new Vector<String>(); //Adding elements to the first Vector va.add("AB"); va.add("BC"); va.add("CD"); va.add("DE"); //Second Vector Vector<String> vb = new Vector<String>(); //Adding elements to the second Vector vb.add("1st"); vb.add("2nd"); vb.add("3rd"); vb.add("4th"); vb.add("5th"); vb.add("6th"); /*Displaying the elements of second vector before performing the copy operation*/ System.out.println("Vector vb before copy: "+vb); //Copying all the elements of Vector va to Vector vb Collections.copy(vb, va); //Displaying elements after copy System.out.println("Vector vb after copy: "+vb); } } ``` 輸出: ```java Vector vb before copy: [1st, 2nd, 3rd, 4th, 5th, 6th] Vector vb after copy: [AB, BC, CD, DE, 5th, 6th] ```
                  <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>

                              哎呀哎呀视频在线观看