Java Vector to String convertVectorToStringArray(Vector vector)

Here you can find the source of convertVectorToStringArray(Vector vector)

Description

Convert the passed vector into a string array

License

Open Source License

Parameter

Parameter Description
vector The Vector to convert

Return

an array of strings.

Declaration

public static String[] convertVectorToStringArray(Vector vector) 

Method Source Code

//package com.java2s;
/* IBS Copyright/Security Notice ***************************************
 *                                              
 *  BAP Property of IBS AB//from  w ww .ja v a  2  s .  c o m
 *  (C) Copyright IBS AB 2001-2003
 *  All rights reserved.                        
 *  Use, duplication, or disclosure restricted  
 *  by license agreement with IBS AB.           
 *                                              
 *  Licensed Materials - Property of IBS AB     
 *                                              
 * End IBS Copyright/Security Notice **********************************
 *
 *
 * User  Date          Comment     
 * ---------------------------------------------------------------------
 * DMA   01/01/2000    Class created
 *  
 ***********************************************************************/

import java.util.*;

public class Main {
    /**
     * Convert the passed vector into a string array
     *
     * @param   vector      The Vector to convert
     * @return   an array of strings.
     */
    public static String[] convertVectorToStringArray(Vector vector) {

        if (vector == null)
            return new String[0];

        String[] arr = new String[vector.size()];
        for (int i = 0; i < vector.size(); i++)
            arr[i] = vector.elementAt(i).toString();

        return arr;
    }
}

Related

  1. convertVectorToString(Vector source, String separator)
  2. toStringArray(Vector V)
  3. vector2string(AbstractList v, String sep)
  4. vector2String(Vector v, String delimiter)
  5. vector_to_strings(Vector v)