ArrayList connectionSet = new ArrayList(); for (int i = 0; i < 3; i++) { ConnectionSettings temp = new ConnectionSettings(); temp.setHost(getFirstAttrbuteByTagName(new String[] {"options", "remote"+i, "host"})); temp.setXmlPort(Integer.parseInt(getFirstAttrbuteByTagName(new String[] {"options", "remote"+i, "port"}))); if ("".equals(temp.getHost())) break; connectionSet.add(temp); } return (ConnectionSettings[])connectionSet.toArray(new ConnectionSettings[]{}); }
ArrayList connectionSet = new ArrayList(); for (int i = 0;; i++) { ConnectionSettings temp = new ConnectionSettings(); temp.setHost(propertyHandler.get("options_remote" + i + "_host")); if (temp.getHost().length() == 0){ break; } Integer tmpPort = propertyHandler.getAsInt( "options_remote" + i + "_port"); if (tmpPort != null){ temp.setXmlPort(tmpPort.intValue()); } else{ temp.setXmlPort(-1); } connectionSet.add(temp); } return (ConnectionSettings[]) connectionSet .toArray(new ConnectionSettings[] {}); }
    public ConnectionSettings[] getConnectionsSet() {        ArrayList connectionSet = new ArrayList();        for (int i = 0; i < 3; i++) {            ConnectionSettings temp = new ConnectionSettings();            temp.setHost(getFirstAttrbuteByTagName(new String[] {"options", "remote"+i, "host"}));            temp.setXmlPort(Integer.parseInt(getFirstAttrbuteByTagName(new String[] {"options", "remote"+i, "port"})));            if ("".equals(temp.getHost()))                break;            connectionSet.add(temp);        }        return (ConnectionSettings[])connectionSet.toArray(new ConnectionSettings[]{});    }