public void updateEditableCollectionLines( ProposalDevelopmentDocumentForm form, String selectedCollectionPath) { List<String> indexes = new ArrayList<>(); indexes.add("0"); for (String index : form.getEditableCollectionLines().get(selectedCollectionPath)) { Integer newIndex = Integer.parseInt(index) + 1; indexes.add(newIndex.toString()); } form.getEditableCollectionLines().get(selectedCollectionPath).clear(); form.getEditableCollectionLines().get(selectedCollectionPath).addAll(indexes); }
public void addEditableCollectionLine( ProposalDevelopmentDocumentForm form, String selectedCollectionPath) { if (form.getEditableCollectionLines().containsKey(selectedCollectionPath)) { updateEditableCollectionLines(form, selectedCollectionPath); } else { List<String> newKeyList = new ArrayList<>(); newKeyList.add("0"); form.getEditableCollectionLines().put(selectedCollectionPath, newKeyList); } }