Java: Best way to remove duplicated list in a list [duplicate]
问题 This question already has answers here : How do I remove repeated elements from ArrayList? (38 answers) Closed 2 years ago . I have a list of list: List<List<Integer>> myList = new ArrayList<>(); What would be the best way to remove the duplicated list in myList? For example, in the following list of list: [[-1,0,1],[-1,-1,2],[-1,0,1]] I would like to reduce it to: [[-1,0,1],[-1,-1,2]] Thanks! 回答1: The easiest way is to copy it into an order-preserving set (or, more generally, any kind of set