Formation formation = new Formation(); formation.setHeading(formationsName[index]); formation.setIdFormation(formationsId[index]); list.add(formation);
if (index > 0) { Formation formation = new Formation(); formation.setHeading(formationsName[index]); formation.setIdFormation(formationsId[index]); list.add(formation); }
    public Set getFormations() {		HashSet list = new HashSet();		Component[] components = formationsPanel.getComponents();				for(int i = 0; i < components.length; ++i) {		    if (components[i] instanceof JComboBox) {		        int index = ((JComboBox)components[i]).getSelectedIndex();		        Formation formation = new Formation();		        formation.setHeading(formationsName[index]);		        formation.setIdFormation(formationsId[index]);		        list.add(formation);		    }		}				return list;    }