Java List Transform transformIntoAList(String... elements)

Here you can find the source of transformIntoAList(String... elements)

Description

transform Into A List

License

Open Source License

Parameter

Parameter Description

Return

a list of all of those Strings

Declaration

public static List<String> transformIntoAList(String... elements) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2016 Logimethods//w w  w  .  jav a  2s.c  om
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the MIT License (MIT)
 * which accompanies this distribution, and is available at
 * http://opensource.org/licenses/MIT
 *******************************************************************************/

import java.util.ArrayList;

import java.util.List;

public class Main {
    /**
     * @param elements, a undefined number of String(s)
     * @return a list of all of those Strings 
     */
    public static List<String> transformIntoAList(String... elements) {
        ArrayList<String> list = new ArrayList<String>(elements.length);
        for (String element : elements) {
            list.add(element.trim());
        }
        return list;
    }
}

Related

  1. stringToList(final String stringToTransform)
  2. transform(final List l)
  3. transform(List> values)
  4. transformCollectionTOList(Collection collection)
  5. transformContinuouslyVariablesByThreshold(List> data, int index, int threshold)
  6. transformNumberedPropertiesToList(Properties props)
  7. transformStringListToString(List fileContentAsList)
  8. transformStringToListOfStrings(String line)
  9. transformToDoublePrimitiveArray( List values)