/** * Validate that there is only a single element in the {@code collection} and return it. */ public static <T> T getSingle(Collection<T> collection) { Validate.isTrue(collection.size() == 1, "%s is not a singleton.", collection); return getAny(collection); }
/** * Validate that there is at most one element in the {@code collection} and return it (or {@code null} otherwise). */ public static <T> T getSingleOrNull(Collection<T> collection) { Validate.isTrue(collection.size() <= 1, "Expected 0 or 1 elements, found %d.", collection.size()); return collection.isEmpty() ? null : getAny(collection); }
final OutputSlot<?> execOutput = baseConcatGroup.execOutput; Set<PlanImplementation.ConcatenationDescriptor> baseConcatDescriptors = concatGroup2concatDescriptor.get(baseConcatGroup); final PlanImplementation innerPlanImplementation = RheemCollections.getAny(baseConcatDescriptors).execOutputPlanImplementation;
Channel existingChannel = RheemCollections.getAny(openChannels); while (existingChannel.getProducerSlot() != sourceOutput) { existingChannel = OptimizationUtils.getPredecessorChannel(existingChannel);