* Perform an explicit copy, because Collections2.transform() is lazily transformed and retains pointer to
* original collection, which may contains references to mutable context.
*/
- final Collection<StatementContextBase<?, ?, ?>> declaredSubstatements = context.declaredSubstatements();
- substatements = ImmutableList.copyOf(Collections2.transform(declaredSubstatements, StatementContextBase::buildDeclared));
+ substatements = ImmutableList.copyOf(Collections2.transform(context.declaredSubstatements(),
+ StatementContextBase::buildDeclared));
}
protected final <S extends DeclaredStatement<?>> S firstDeclared(final Class<S> type) {
private static boolean checkFeatureSupport(final StmtContext.Mutable<?, ?, ?> stmtContext,
final Predicate<QName> isFeatureSupported) {
- final Collection<StatementContextBase<?, ?, ?>> substatements = stmtContext.declaredSubstatements();
-
boolean isSupported = false;
boolean containsIfFeature = false;
- for (final StatementContextBase<?, ?, ?> stmt : substatements) {
- if (stmt.getPublicDefinition().equals(YangStmtMapping.IF_FEATURE)) {
+ for (final StatementContextBase<?, ?, ?> stmt : stmtContext.declaredSubstatements()) {
+ if (YangStmtMapping.IF_FEATURE.equals(stmt.getPublicDefinition())) {
containsIfFeature = true;
if (isFeatureSupported.test((QName) stmt.getStatementArgument())) {
isSupported = true;
public void onPreLinkageDeclared(final Mutable<String, ModuleStatement, EffectiveStatement<String, ModuleStatement>> stmt) {
final String moduleName = stmt.getStatementArgument();
- final URI moduleNs = firstAttributeOf(stmt.declaredSubstatements(),
- NamespaceStatement.class);
+ final URI moduleNs = firstAttributeOf(stmt.declaredSubstatements(), NamespaceStatement.class);
SourceException.throwIfNull(moduleNs, stmt.getStatementSourceReference(),
"Namespace of the module [%s] is missing", stmt.getStatementArgument());
stmt.addToNs(ModuleNameToNamespace.class, moduleName, moduleNs);