// "Replace with collect" "true" import java.util.List; public class Test { static String test(List list) { StringBuilder sb = new StringBuilder(); System.out.println("hello"); for(String s : list) { if(!s.isEmpty()) { sb.append(s.trim()); } } String s = "Result: "; s += sb; System.out.println(s); return "[" + sb + "]"; } }