arrays - Passing multiple types of related variables(Java) -


im developing app can connect few computers on local network , sends instructions them such as: "run script", "run script" , blocks new connections until finished running scripts.

in short create thread each connection, , need pass them port, ip, instruction, duration, thread name. thread creates socket , passes on through stream instruction , duration. computer on other side acknowledges received instruction , executed script. program should block tries create connection ip address until client answers finished running script allow connections unconnected computers. thread closes streams, socket , , allows new connections computer through new threads.

now problem dont know how create system can scaled eg. add new computers system, scripts , duration values.

i tried this:

        object[0][0] = 2222;                  //port         object[0][1] = "localhost";         object[0][2] = " computer1";          object[1][0] = 2223;         object[1][1] = "192.168.1.113";         object[1][2] = " computer2";          object[2][0] = 2224;         object[2][1] = "192.168.1.108";         object[2][2] = " computer3"; 

but cant figure out way iterate through if want send instructions computer1 , computer3 either same or different instructions.

as pjklauser said, can start simple pojo class config example:

import java.util.arraylist;  public class config{  private string host; private int port; private string payload;  public config(string host, int port, string payload){     this.host = host;     this.port = port;     this.payload = payload; }  public string gethost() {     return host; }  public void sethost(string host) {     this.host = host; }  public int getport() {     return port; }  public void setport(int port) {     this.port = port; }  public string getpayload() {     return payload; }  public void setpayload(string payload) {     this.payload = payload; }  @override public string tostring(){     return this.host + " " + this.port + " " + this.payload; }   public static void main(string []args){      arraylist<config> configs = new arraylist<config>();      config c1 = new config("localhost", 2222, "to computer1");      config c2 = new config("localhost", 2223, "to computer2");       configs.add(c1);      configs.add(c2);       (config c: configs){          system.out.println(c.tostring());      }  } } 

i hope help!