java - How to format array in string -


i want format log this:

"order orderid=1,orderid=2,orderid=3,orderid=4" 

i have array values [1,2,3,4]. understand enough easy use loop want know if there tool in jdk (or library) can this.

using java 8:

int[] n = new int[]{1,2,3,4}; string orders = arrays.stream(n).maptoobj(i -> "orderid=" + i).collect(collectors.joining(",")); string result = "order " + orders; 

Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -