I have a List of objects and I want to remove the duplicates based on criteria: compare the descr value, if at least one row has Invalid as descr's value, use that object and remove the rest of the objects with the same row value.
class Sample {
  public String row;
  public String descr;
}
Sample input data:
[{"01", "Invalid"}, {"01", "One more"}, {"02", "Invalid"}, {"03", "another test"}]
Result should be:
[{"01", "Invalid"}, {"02", "Invalid"}, {"03", "another test"}]
 
     
     
    