Now I know which one is a duplicate. But how can I filter the lineList again to filter out the dups based on some other rules?

In the end I want to have a List with no duplicates anymore but I also want to retain as much information from the properties

ini

and

com

as possible. That means I want to keep the duplicate that follows one of the following rules:

Lines with content in property

ini

and

com

have precedence over all others, meaning:

Line("X", "hello", "some text")

vs

Line("", "hello", "some text")

vs

Line("", "hello", "")

should give back the first

Lines with content in property

com

have precedence over

ini

, meaning:

Line("", "hello", "")

vs

Line("", "hello", "some text")

should give back the last one

Lines with content in property

ini

have precedence over lines with nothing in ini or com, meaning:

Line("X", "hello", "")

vs

Line("", "hello", "")

should give back the first

in case both duplicates have information in

ini

and

com

, I don't care which one is selected.

I wonder if that's not overly complicated and there might be another way to solve this. All I want to accomplish is a List that has no more dups while keeping that dup that had the most information on it. How would one solve this?