A pair of streams representing a client is a domain concept in your application and should probably be captured in a meaningful class. Something like this at a bare minimum:
public class Client {
public DataOutputStream outStream;
public DataInputStream inStream;
public Client(DataOutputStream out, DataInputStream in) {
this.outStream = out;
this.inStream = in;
}
}
Whenever you create your streams for a client stick them in an instance of this Client
class. Then you can put the Client
objects in a List
and iterate all you want.
for (Client client : clientList) {
// do whatever you want with client.outStream and client.inStream
}
Now you end up with a List<Client>
, which is much easier for a person to grok than a HashSet<ArrayList<Object>>
.