I am new to Java 8 and looking to implement below in Java 8 only.
I have the following numbers
1111
2222
3333
4444
I want to convert all these numbers like '1111','2222','3333','4444' The list of numbers can be anything and it should be dynamic
I developed code like below, but only servers half purpose
List<String> numbers = Arrays.asList("111", "2222", "3333", "4444");
String collect = numbers.stream().map(n -> n).collect(Collectors.joining(",'"));
System.out.println(collect);
Output:
111,'2222,'3333,'4444