Here you can find the source of trimStringToNewList(List
public static List<String> trimStringToNewList(List<String> list, Boolean isLower)
//package com.java2s; /*/*from ww w. java 2 s. com*/ * Copyright (C) 2012 Viettel Telecom. All rights reserved. * VIETTEL PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ import java.util.ArrayList; import java.util.List; public class Main { public static List<String> trimStringToNewList(List<String> list, Boolean isLower) { List<String> temp = new ArrayList<>(); String str = null; for (int i = 0; i < list.size(); i++) { temp.add(isLower ? list.get(i).trim().toLowerCase() : list.get(i).trim()); } return temp; } }