String[] arrayA = new String[] { "1", "2", "3", "3", "4", "5" };
String[] arrayB = new String[] { "3", "4", "4", "5", "6", "7" };
List a = Arrays.asList( arrayA );
List b = Arrays.asList( arrayB );
Collection union = CollectionUtils.union( a, b );
Collection intersection = CollectionUtils.intersection( a, b );
Collection disjunction = CollectionUtils.disjunction( a, b );
Collection subtract = CollectionUtils.subtract( a, b );
Collections.sort( union );
Collections.sort( intersection );
Collections.sort( disjunction );
Collections.sort( subtract );
System.out.println( "A: " + ArrayUtils.toString( a.toArray( ) ) );
System.out.println( "B: " + ArrayUtils.toString( b.toArray( ) ) );
System.out.println( "Union: " + ArrayUtils.toString( union.toArray( ) ) );
System.out.println( "Intersection: " +
ArrayUtils.toString( intersection.toArray( ) ) );
System.out.println( "Disjunction: " +
ArrayUtils.toString( disjunction.toArray( ) ) );
System.out.println( "Subtract: " + ArrayUtils.toString( subtract.toArray( ) ) );
String[] arrayA = new String[] { "1", "2", "3", "3", "4", "5" };
String[] arrayB = new String[] { "3", "4", "4", "5", "6", "7" };
List a = Arrays.asList( arrayA );
List b = Arrays.asList( arrayB );
Collection union = CollectionUtils.union( a, b );
Collection intersection = CollectionUtils.intersection( a, b );
Collection disjunction = CollectionUtils.disjunction( a, b );
Collection subtract = CollectionUtils.subtract( a, b );
Collections.sort( union );
Collections.sort( intersection );
Collections.sort( disjunction );
Collections.sort( subtract );
System.out.println( "A: " + ArrayUtils.toString( a.toArray( ) ) );
System.out.println( "B: " + ArrayUtils.toString( b.toArray( ) ) );
System.out.println( "Union: " + ArrayUtils.toString( union.toArray( ) ) );
System.out.println( "Intersection: " +
ArrayUtils.toString( intersection.toArray( ) ) );
System.out.println( "Disjunction: " +
ArrayUtils.toString( disjunction.toArray( ) ) );
System.out.println( "Subtract: " + ArrayUtils.toString( subtract.toArray( ) ) );
The previous example performs these four operations on two List objects, a and b, printing the results with ArrayUtils.toString( ):
Java代码
A: {1,2,2,2,3,3,4,5}
B: {3,4,4,5,6,7}
Union: {1,2,2,2,3,3,4,4,5,6,7}
Intersection: {3,4,5}
Disjunction: {1,2,2,2,3,4,6,7}
Subtract: {1,2,2,2,3}
分享到:
相关推荐
Carry out classification decisions using Borda counts, MinMax and MaxMin rules, union and intersection rules, logistic regression, selection by local accuracy, maximization of the fuzzy integral, and...
LineIntersection.java
python计算3D IoU(3D Intersection-over-Union,IoU)代码
python 并集union, 交集intersection, 差集difference, 对称差集symmetric_difference a,b,c = [1,2,3],[2,3,4],[3,4,5] print('------>union') print('a,b取并集:',set(a).union(b)) print('a,b取并集:',set(a...
本文提出了一种用于道路网提取以及交叉路口识别的方法。
总计225M,1000多页,这是第四章 CHAPTER 04. PRIMITIVES AND INTERSECTION ACCELERATION
Resource collections group resources, and can be further combined with operators such as union and intersection. This can be extended by custom resources and custom tasks using resources. Ant 1.7 ...
mIou import torch import numpy as np def Iou(input,target,classNum): ''' :param input: [b,h,w] :param target: [b,h,w] :param classNum: scalar :return: ... inputTmp = torch.zeros([input.shape[0],...
Type lattices and union and intersection types Polymorphism and substitutability Compile time and run time binding All of these topics are described in detail in the book, with numerous illustrative ...
Constructive Solid Geometry allows you to create new meshes by performing Subtraction, Union and Intersection between objects.
Constructive Solid Geometry allows you to create new meshes by performing Subtraction, Union and Intersection between objects.
Randy B. Lee & David A. Fredricks的intersection of parametric surfaces and plane
intersection.cpp
本书由斯坦福大学Mining of massive dateset等人编写,系统地介绍了数据挖掘的各种方法。
判断两条直线是否平行,也可以判断是否相交,并可以求出交点。
smarter-decisions-intersection-of-iot.pdf
使用UG OPEN进行Point Constructor中的intersection point的类似功能开发
matlab开发-type2unionorintersection。以评估类型2下的联合或交叉操作。
Intersection surface drawing.