append Into Vector - Java java.util

Java examples for java.util:Vector

Description

append Into Vector

Demo Code


//package com.java2s;
import java.util.*;

public class Main {
    public static Vector appendInto(Vector v, Object[] array) {
        appendInto(v, array, array.length);
        return v;
    }//from  w w  w. j  a va 2  s.  co  m

    public static Vector appendInto(Vector v, Object[] array, int quantity) {
        v.ensureCapacity(v.size() + quantity);
        for (int i = 0; i < quantity; i++) {
            v.addElement(array[i]);
        }

        return v;
    }

    public static Vector appendInto(Vector dest, Vector src) {
        Enumeration e = src.elements();
        while (e.hasMoreElements())
            dest.addElement(e.nextElement());
        return dest;
    }
}

Related Tutorials