Java 中的 List 和 Set 集合类型详解
list
and set
列表去重
a = [1,2,3,3]
list = list(set(a))
集合的运算
a = {1,2,3,3}
b = {3,4,5}
#交集 {3}
a.intersection(b)
#并集 {1, 2, 3, 4, 5}
a.union(b)
Last updated
Was this helpful?
list
and set
列表去重
a = [1,2,3,3]
list = list(set(a))
集合的运算
a = {1,2,3,3}
b = {3,4,5}
#交集 {3}
a.intersection(b)
#并集 {1, 2, 3, 4, 5}
a.union(b)
Last updated
Was this helpful?