I've a Object val with values [0,2,4,5,9], actually these values are been created from TreeSet like as shown below
TreeSet ts=new TreeSet ();
ts.add(0);
ts.add(2);
ts.add(4);
ts.add(5);
ts.add(9);
System.out.println(ts);
Output
[0,2,4,5,9]
i'm passing the output as string from server to client side
in the client side i 've
Object obj="[0,2,4,5,9]";
Can anyone please tell me how to convert the object values [0,2,4,5,9] to TreeSet Object so that i can iterate the values
You can send the treeset value back to the client in the form of JSONArray
. I would recommend you to look into org.json
package to easily do these kind of client and server interaction.
Note : JSON is light-weight data interchange format than xml. Latest browsers support json as a defacult standard. if you further want to go for string based value, you have to make use of javascript
function to split the values and make use of them