Java ArrayList Create getArrayList(String[] args)

Here you can find the source of getArrayList(String[] args)

Description

get Array List

License

Open Source License

Declaration

public static ArrayList getArrayList(String[] args) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2004, 2011 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * //from  ww w . j  a  v a 2  s.  c om
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

import java.util.ArrayList;

public class Main {
    public static ArrayList getArrayList(String[] args) {
        if (args == null) {
            return null;
        }
        // We could be using Arrays.asList() here, but it does not specify
        // what kind of list it will return. We need a list that
        // implements the method List.remove(Object) and ArrayList does.
        ArrayList result = new ArrayList(args.length);
        for (int i = 0; i < args.length; i++) {
            result.add(args[i]);
        }
        return result;
    }
}

Related

  1. getArrayList()
  2. getArrayList()
  3. getArrayList(final Object o, final Class clazz)
  4. getArrayList(List list)
  5. getArrayList(Map map, Object obj)
  6. getArrayListForArray(Object[] rowData)
  7. getArrayListFromInt(int number)
  8. getArrayListFromString(String wordSequence, String separator)
  9. newArrayList()