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

Method create

corpus/java/training/guava/collect/Sets.java:1176–1205  ·  view source on GitHub ↗
(List<? extends Set<? extends E>> sets)

Source from the content-addressed store, hash-verified

1174 private final transient CartesianList<E> delegate;
1175
1176 static <E> Set<List<E>> create(List<? extends Set<? extends E>> sets) {
1177 ImmutableList.Builder<ImmutableSet<E>> axesBuilder =
1178 new ImmutableList.Builder<ImmutableSet<E>>(sets.size());
1179 for (Set<? extends E> set : sets) {
1180 ImmutableSet<E> copy = ImmutableSet.copyOf(set);
1181 if (copy.isEmpty()) {
1182 return ImmutableSet.of();
1183 }
1184 axesBuilder.add(copy);
1185 }
1186 final ImmutableList<ImmutableSet<E>> axes = axesBuilder.build();
1187 ImmutableList<List<E>> listAxes =
1188 new ImmutableList<List<E>>() {
1189 @Override
1190 public int size() {
1191 return axes.size();
1192 }
1193
1194 @Override
1195 public List<E> get(int index) {
1196 return axes.get(index).asList();
1197 }
1198
1199 @Override
1200 boolean isPartialView() {
1201 return true;
1202 }
1203 };
1204 return new CartesianSet<E>(axes, new CartesianList<E>(listAxes));
1205 }
1206
1207 private CartesianSet(ImmutableList<ImmutableSet<E>> axes, CartesianList<E> delegate) {
1208 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