I have a sting with multiple %s for string formatting. And i have an array of strings which are supposed to be arguments for string formatting. Like this
List<String> list = new ArrayList<>();
list.add("A");
list.add("B");
String toFormat = "This is a first value %s, This is a second value %s"
String result = String.formant (toFormat, list.get(0), list.get(1));
But it doesn't look good with a number of element greater than 2. How can i format a string without picking each argument from list individually?