Java Vector Add addAll(Vector vector, Object[] copyFrom)

Here you can find the source of addAll(Vector vector, Object[] copyFrom)

Description

Appends all items from given array after last item of the vector.

License

Open Source License

Parameter

Parameter Description
vector here all items will be appended.
copyFrom array to append.

Declaration

public static void addAll(Vector vector, Object[] copyFrom) 

Method Source Code


//package com.java2s;
/*/*  w w w . j  a va 2s  .c  om*/
 The Bluetooth Library for client-server communication
 Copyright (C) 2006 Martin Vysny
    
 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.
    
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 */

import java.util.*;

public class Main {
    /**
     * Appends all items from given array after last item of the vector.
     * <p/>
     * @param vector
     * here all items will be appended.
     * @param copyFrom
    * array to append.
     */
    public static void addAll(Vector vector, Object[] copyFrom) {
        if (copyFrom == null) {
            return;
        }
        vector.ensureCapacity(vector.size() + copyFrom.length);
        for (int i = 0; i < copyFrom.length; i++) {
            vector.addElement(copyFrom[i]);
        }
    }
}

Related

  1. add(List> vectors)
  2. add(Vector left, Vector right)
  3. Add(Vector V, String S1, String S2, String S3)
  4. addArray(Vector vector, Object[] array)
  5. addToVector(Vector from, Vector to)
  6. vectorAdd(double[] v1, double[] v2)
  7. vectorAdd(double[] v1, double[] v2)