I’ve a list which is
List < TempVO> lstTemp = new ArrayList < TempVO> ();
TempVO is a class containing
zoneId,tempId and tempValue
now the list will have entries like mentioned below
zoneId tempId tempValue
-----------------------
2 / 1 / check
2 / 3 /check
2 / 4 / check
2 / 4 / entered1
3 / 5 / check
3 / 8 / primary
3 / 6 / check
3 / 8 / check
My requirement is to remove that entries with tempValue= check from the list where if it has 2 entries for the same zoneId and tempId
(i,e) my new list should contain
zoneId tempId tempValue
-----------------------
2 / 1 / check
2 / 3 /check
2 / 4 / entered1
3 / 5 / check
3 / 8 / primary
3 / 6 / check
How do i do this?
I wrote something up for you. I implemented the class TempVO and iterated over a list of those in a main function(my programs entry point) using a nested loop. I check for every TempVO if the tempValue is “check”. If so, I check if there is another TempVO in the list with the same zoneId and tempId. If so, I don’t print the TempVO. You can follow it in my code: