Java List Trim trimStringLineList(List lines)

Here you can find the source of trimStringLineList(List lines)

Description

Trims a List of String lines.

License

Open Source License

Parameter

Parameter Description
list input List of String lines

Return

List of trimmed String itlinesems

Declaration

public static List<String> trimStringLineList(List<String> lines) 

Method Source Code

//package com.java2s;
/**//from  ww w.  ja  v a  2s  . c o m
* Copyright (C) 2015-present by Permeance Technologies
*
* This program 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 3 of the
* License, or (at your option) any later version.
* 
* 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.
*
* You should have received a copy of the GNU General Public License along with this program. If
* not, see <http://www.gnu.org/licenses/>.
*/

import java.util.ArrayList;
import java.util.List;

public class Main {
    /** 
     * Trims a List of String lines.
     * 
     * @param list input List of String lines
     * @return List of trimmed String itlinesems
     */
    public static List<String> trimStringLineList(List<String> lines) {

        List<String> newLines = new ArrayList<String>();

        if (lines != null) {
            for (String line : lines) {
                String str = line;
                str = line.trim();
                String newLine = str;
                newLines.add(newLine);
            }
        }

        return newLines;
    }
}

Related

  1. trimLeadingWhitespaces(List lines)
  2. trimList(List list)
  3. trimList(List source)
  4. trimListValues(List original)
  5. trimSequence(int m, List sequence)
  6. trimStrings(List list)
  7. trimStringToNewList(List list, Boolean isLower)
  8. trimSuffix(List strs)
  9. trimToList(String importOrder1)