Here you can find the source of trimList(List
Parameter | Description |
---|---|
source | The strings to be converted |
public static List<String> trimList(List<String> source)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; public class Main { /**/*from ww w.j a v a 2s .c o m*/ * Trims all items in a list of strings. A string that starts with a * single backslash has that backslash removed. * @param source The strings to be converted * @return The converted strings */ public static List<String> trimList(List<String> source) { List<String> result = new ArrayList<String>(source.size()); for (int i = 0; i < source.size(); i++) { String trimmedValue = source.get(i).trim(); if (trimmedValue.startsWith("\\")) { trimmedValue = trimmedValue.substring(1); } result.add(trimmedValue); } return result; } }