MCPcopy Create free account
hub / github.com/antlr/codebuff / create

Method create

output/java_guava/1.4.17/Sets.java:1224–1251  ·  view source on GitHub ↗
(List<? extends Set<? extends E>> sets)

Source from the content-addressed store, hash-verified

1222 private final transient CartesianList<E> delegate;
1223
1224 static <E> Set<List<E>> create(List<? extends Set<? extends E>> sets) {
1225 ImmutableList.Builder<ImmutableSet<E>> axesBuilder = new ImmutableList.Builder<ImmutableSet<E>>(sets.size());
1226 for (Set<? extends E> set : sets) {
1227 ImmutableSet<E> copy = ImmutableSet.copyOf(set);
1228 if (copy.isEmpty()) {
1229 return ImmutableSet.of();
1230 }
1231 axesBuilder.add(copy);
1232 }
1233 final ImmutableList<ImmutableSet<E>> axes = axesBuilder.build();
1234 ImmutableList<List<E>> listAxes = new ImmutableList<List<E>>() {
1235 @Override
1236 public int size() {
1237 return axes.size();
1238 }
1239
1240 @Override
1241 public List<E> get(int index) {
1242 return axes.get(index).asList();
1243 }
1244
1245 @Override
1246 boolean isPartialView() {
1247 return true;
1248 }
1249 };
1250 return new CartesianSet<E>(axes, new CartesianList<E>(listAxes));
1251 }
1252
1253 private CartesianSet(ImmutableList<ImmutableSet<E>> axes, CartesianList<E> delegate) {
1254 this.axes = axes;

Callers 1

cartesianProductMethod · 0.95

Calls 6

copyOfMethod · 0.95
ofMethod · 0.95
addMethod · 0.95
buildMethod · 0.95
sizeMethod · 0.65
isEmptyMethod · 0.65

Tested by

no test coverage detected