Sample data store in hashmap is as ,
e.g.
{“client1-data1″:data1,”client2-data2″:data2,”client3-data3″:data3,”client4-data4″:data4,”client1-data2″:data2,”client2-data1″:data1,”client3-data4″:data4,”client4-data3”:data3}
every data can be get repeated for every other client , the key will be unique as client1-data1 combination value will get repeated but key will be unique.
Issue for handling multiple clients,
for every user , a different thread is created while making a connection so every thread will created a PrintWriter object which gets added to a Arraylist
List writers = new ArrayList();
Is their anyways where i can store the client_id along with the Printwriter object in the same array and pass the data to clients while filter the data with that client id as stored in the Hashmap in the above example.
PLease do reply/suggest
thanks,
Praveen T
You can use a collection which stores a pair of elements. A round about way of doing this is to use a Map.
You can loop over these using
If you want to be able to get one clientId at a time you can use