Java List Trim trim(final List row)

Here you can find the source of trim(final List row)

Description

Trim all values in row.

License

Open Source License

Parameter

Parameter Description
row a parameter

Declaration

private static List<String> trim(final List<String> row) 

Method Source Code

//package com.java2s;
/**/* ww w .j a  v a 2  s. c om*/
 * @UNCC Fodor Lab
 * @author Michael Sioda
 * @email msioda@uncc.edu
 * @date Feb 9, 2017
 * @disclaimer    This code 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,
 *             provided that any use properly credits the author.
 *             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 at http://www.gnu.org *
 */

import java.util.ArrayList;

import java.util.Iterator;
import java.util.List;

public class Main {
    /**
     * Trim all values in row.
     * @param row
     * @return
     */
    private static List<String> trim(final List<String> row) {
        final List<String> formattedRow = new ArrayList<>();
        final Iterator<String> it = row.iterator();
        while (it.hasNext()) {
            formattedRow.add(it.next().trim());
        }

        return formattedRow;
    }
}

Related

  1. stringToListTrim(String str, char delimiter)
  2. toDelimitedString(List values, String delimiter, boolean trimValues)
  3. tokenizeAndTrimToList(String value, String delimiter)
  4. toList(final String line, final boolean trimSpaces)
  5. toStringList(List list, String delimiter, boolean isTrim, boolean isRemoveEmpty)
  6. trim(List data, boolean removeEmptyLines)
  7. trim(List strs)
  8. trimElements(List list)
  9. trimEndDigital(List strs)