Commit 6ac2978 1 parent 435fd7d commit 6ac2978 Copy full SHA for 6ac2978
File tree 1 file changed +11
-0
lines changed
src/java/org/tensorics/core/tensor
1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 33
33
import java .util .function .Function ;
34
34
import java .util .stream .Collectors ;
35
35
36
+ import org .mockito .internal .util .collections .Iterables ;
37
+
36
38
import com .google .common .base .MoreObjects ;
37
39
import com .google .common .base .Objects ;
38
40
import com .google .common .base .Preconditions ;
@@ -384,6 +386,15 @@ public static Set<Position> cartesianProduct(Iterable<Set<?>> coordinateSets) {
384
386
return cartesianProduct .stream ().map (l -> Position .of (new HashSet <>(l ))).collect (toSet ());
385
387
}
386
388
389
+ public static <T > Set <Position > from (Collection <T > coordinates ) {
390
+ return coordinates .stream ().map (t -> Position .of (t )).collect (toSet ());
391
+ }
392
+
393
+ public static <T > Set <Position > from (T ... coordinates ) {
394
+ return from (ImmutableSet .copyOf (coordinates ));
395
+ }
396
+
397
+
387
398
/**
388
399
* Returns a position which contains the coordinates which are contained in the left position but not in the right
389
400
* position. The right position might also contain coordinates not contained in the left position, which are simply
You can’t perform that action at this time.
0 commit comments