Java:删除列表中重复列表的最佳方法 [英] Java: Best way to remove duplicated list in a list

查看:104
本文介绍了Java:删除列表中重复列表的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表列表:

List<List<Integer>> myList = new ArrayList<>();

在myList中删除重复列表的最佳方法是什么?

What would be the best way to remove the duplicated list in myList?

例如,在以下列表中:

[[-1,0,1],[-1,-1,2],[-1,0,1]]

我想将其减少为:

[[-1,0,1],[-1,-1,2]]

谢谢!

推荐答案

使用Set而不是列表.集不允许重复. 设置"和列表"之间有什么区别?

Use a Set instead of a list. Sets do not allow duplicates. What is the difference between Set and List?

这篇关于Java:删除列表中重复列表的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆