I have a List of String and I would like to append text in front of each String in the list. I am trying to achieve this without a for/Iterator loop like a single line of code. I can't find a solution to this.
Following I have tried with a for loop but need solution without this. Is there a solution?
List<String> strings = new ArrayList<String>();
strings.add("a");
strings.add("b");
strings.add("c");
strings.add("d");
List<String> appendedList = new ArrayList<String>();
for (String s : strings) {
appendedList.add("D" + s);
}
Please help. Thanks.