java - How to toString() a List like this one : List<Option>? -


suppose have list of object called option :

list<option> opts = arraylist<option>(); 

i have override tostring() object option.

when opts.tostring() means tostring list , unnecessary commas ,,,,,.

i change that. please, there way better for-looping inside list tostring each element ? hope clear.

i guess not idea override tostring of arraylist, can create own print function in utility class of application:

public static string mytostring(list<?> list) {     stringbuilder stringlist = new stringbuilder();     string delimiter = " ";     (int c = 0; c < list.size(); c++) {         stringlist.append(delimiter);         stringlist.append(list.get(c));     }     return stringlist.tostring(); } 

Comments

Popular posts from this blog

gcc - MinGW's ld cannot perform PE operations on non PE output file -

timeout - Handshake_timeout on RabbitMQ using python and pika from remote vm -

c# - Search and Add Comment with OpenXML for Word -