Java中用于集合操作的API? [英] API for set operations in Java?

查看:24
本文介绍了Java中用于集合操作的API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有用于集合操作的 API,例如联合、交集、差异、笛卡尔积、从一个集合到另一个集合的函数、这些函数的域限制和范围限制……在 Java 中?

Is there an API for Set operations like Union, intersection, difference, Cartesian product, Function from a set to another, domain restriction and range restriction of those functions, .... in Java?

请评论(操作的)覆盖范围和性能.

Please comment on coverage (of operations) and performance.

谢谢

推荐答案

是的,java Set 类.

Yes, the java Set class.

通过 Java SE 教程:

Via Java SE tutorial:

s1.containsAll(s2) — 如果 s2 是 s1 的子集,则返回 true.(s2 是一个如果集合 s1 包含 s2 中的所有元素,则为 s1 的子集.)

s1.containsAll(s2) — returns true if s2 is a subset of s1. (s2 is a subset of s1 if set s1 contains all of the elements in s2.)

s1.addAll(s2) — 将 s1 转换为 s1 和 s2 的并集.(这两个集合的并集是包含所有元素的集合在任何一组中.)

s1.addAll(s2) — transforms s1 into the union of s1 and s2. (The union of two sets is the set containing all of the elements contained in either set.)

s1.retainAll(s2) — 将 s1 转换为 s1 和 s2 的交集.(两个集合的交集是只包含元素的集合两组通用.)

s1.retainAll(s2) — transforms s1 into the intersection of s1 and s2. (The intersection of two sets is the set containing only the elements common to both sets.)

s1.removeAll(s2) — 将 s1 转换为(非对称)集合s1 和 s2 的差异.(例如,s1减的设定差s2 是包含所有在 s1 中找到但不在s2.)

s1.removeAll(s2) — transforms s1 into the (asymmetric) set difference of s1 and s2. (For example, the set difference of s1 minus s2 is the set containing all of the elements found in s1 but not in s2.)

http://download.oracle.com/javase/tutorial/集合/接口/set.html

这篇关于Java中用于集合操作的API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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