I have a list from a legacy system. Its in a List. Sometimes it may have duplicates.
How do I remove second duplicate (or multiple) while keeping first one? For example, keep 3-furniture and remove 3-TV. Removal is based on alphabetization.
| ProductId | ProductTitle | ProductDescription |
|---|---|---|
| 1 | car | used for driving |
| 2 | book | reading books |
| 3 | furniture | home decorations |
| 3 | TV | TV entertainment |
| 4 | jewelry | fashion item |
@Data
public class Product {
private long productId;
private String productTitle;
private String productDescription;
}