I have a Set named scripts. The class E has elements like id,squence and many more . I want to compare two rows of object E in scripts and remove only if id and sequence are same . how do I do it .I have a code that removes all the rows . Can anyone correct this code to remove only the ones that has id and sequence same .
LinkedList<EditorScriptRow> lList = new LinkedList<EditorScriptRow> (_scriptRows);
for (ListIterator<EditorScriptRow> i = lList.listIterator(); i.hasNext();) {
EditorScriptRow row = i.next();
int k =0;
for (ListIterator<EditorScriptRow> j = lList.listIterator(k+1) j.hasNext();) {
EditorScriptRow row1 = j.next();
if ((row.getTemplateRow().getId() != null) &&
(row.getSequence() != null) &&
(row.getEdit().getName() != null) ) {
if ((row.getSequence().equals(row1.getSequence())) &&
(row.getTemplateRow().getId().equals(row1.getTemplateRow ().getId ())) &&
(row.getEdit().getName().equals(row1.getEdit().getName()))) {
_scriptRows.remove(row);
}
}
}
k++;
}