title: Format text with a list of argument in java
body: <p>I have a sting with multiple <strong>%s</strong> for string formatting. And i have an array of strings which are supposed to be arguments for string formatting. Like this</p>
  <pre><code>List&lt;String&gt; list = new ArrayList&lt;&gt;();
  list.add(&quot;A&quot;);
  list.add(&quot;B&quot;);
  String toFormat =  &quot;This is a first value %s, This is a second value %s&quot;
  String result = String.formant (toFormat, list.get(0), list.get(1));
  </code></pre>
  <p>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?</p>