File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
src/java/org/tensorics/core/tensor Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 3333import java .util .function .Function ;
3434import java .util .stream .Collectors ;
3535
36+ import org .mockito .internal .util .collections .Iterables ;
37+
3638import com .google .common .base .MoreObjects ;
3739import com .google .common .base .Objects ;
3840import com .google .common .base .Preconditions ;
@@ -384,6 +386,15 @@ public static Set<Position> cartesianProduct(Iterable<Set<?>> coordinateSets) {
384386 return cartesianProduct .stream ().map (l -> Position .of (new HashSet <>(l ))).collect (toSet ());
385387 }
386388
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+
387398 /**
388399 * Returns a position which contains the coordinates which are contained in the left position but not in the right
389400 * 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