how to remove arraylist duplicate values

前端 未结 5 436
萌比男神i
萌比男神i 2021-01-14 11:45

I am performing some maintenance tasks on an old system. I have an arraylist that contains following values:

a,b,12
c,d,3
b,a,12
d,e,3
a,b,12
5条回答
  •  感情败类
    2021-01-14 12:08

    Create a class to wrap around a row string (triplet) to provide your equality semantics. Implement the equals() and hashCode() methods. Then use the HashSet method to remove duplicates.

提交回复
热议问题