API在Java集合运算? [英] API for set operations in Java?
问题描述
有没有像欧盟,交,差,笛卡尔积,从一组到另一功能设定操作的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 设置
类。
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.)
<一个href=\"http://download.oracle.com/javase/tutorial/collections/interfaces/set.html\">http://download.oracle.com/javase/tutorial/collections/interfaces/set.html
这篇关于API在Java集合运算?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!