This fixes a mismatch between the comment and what the method
actually does. For some reason we ended up iterating over the same
collection twice.
Furthermore use .forEach() with a self-referencing lambda instead
of Iterables.concat(), as that can be optimized by the implementation.
Change-Id: I6f74794fd58576b9ce34b6f27217b5e81bef4457
Signed-off-by: Robert Varga <rovarga@cisco.com>
import com.google.common.base.Verify;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.ImmutableSet;
import com.google.common.base.Verify;
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
* b) added to augment body also via uses of a grouping and
* such sub-statements are stored in effective sub-statements collection.
*/
* b) added to augment body also via uses of a grouping and
* such sub-statements are stored in effective sub-statements collection.
*/
- for (final StatementContextBase<?, ?, ?> sourceSubStatement : Iterables.concat(
- sourceCtx.declaredSubstatements(), sourceCtx.declaredSubstatements())) {
- checkForMandatoryNodes(sourceSubStatement);
- }
+ sourceCtx.declaredSubstatements().forEach(Definition::checkForMandatoryNodes);
+ sourceCtx.effectiveSubstatements().forEach(Definition::checkForMandatoryNodes);
}
InferenceException.throwIf(StmtContextUtils.isMandatoryNode(sourceCtx),
}
InferenceException.throwIf(StmtContextUtils.isMandatoryNode(sourceCtx),