Source:
<code>protected void performRemove(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); <START> boolean remove = !resource.getChildTypes().stream() <END> .anyMatch(type -> { for (Resource.ResourceEntry entry : resource.getChildren(type)) { if (! entry.isRuntime()) { PathElement path = entry.getPathElement(); if (resource.hasChild(path)) { return true; } } } return false; }); if (remove) { PathAddress address = context.getCurrentAddress(); for (Map.Entry<Capability, Predicate<ModelNode>> entry : this.descriptor.getCapabilities().entrySet()) { if (entry.getValue().test(model)) { Capability capability = entry.getKey(); context.deregisterCapability(capability.resolve(address).getName()); } } ImmutableManagementResourceRegistration registration = context.getResourceRegistration(); for (String name : registration.getAttributeNames(PathAddress.EMPTY_ADDRESS)) { AttributeAccess attributeAccess = registration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, name); if (attributeAccess != null) { AttributeDefinition attribute = attributeAccess.getAttributeDefinition(); if (attribute != null) { if (attribute.hasCapabilityRequirements()) { attribute.removeCapabilityRequirements(context, resource, model.get(attribute.getName())); } } } } this.descriptor.getResourceCapabilityReferences().forEach((reference, resolver) -> reference.removeCapabilityRequirements(context, resource, null, resolver.apply(address))); if (this.requiresRuntime(context)) { for (RuntimeResourceRegistration runtimeRegistration : this.descriptor.getRuntimeResourceRegistrations()) { runtimeRegistration.unregister(context); } } } super.performRemove(context, operation, model); }</code><technical_language>Replace this stream a for loop. Replace anyMatch(...) lambda conditional</technical_language>

Target:
protected void performRemove(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS); boolean remove = true; outer: for (String type : resource.getChildTypes()) { for (Resource.ResourceEntry entry : resource.getChildren(type)) { if (! entry.isRuntime()) { PathElement path = entry.getPathElement(); if (resource.hasChild(path)) { remove = false; break outer; } } } } if (remove) { PathAddress address = context.getCurrentAddress(); for (Map.Entry<Capability, Predicate<ModelNode>> entry : this.descriptor.getCapabilities().entrySet()) { if (entry.getValue().test(model)) { Capability capability = entry.getKey(); context.deregisterCapability(capability.resolve(address).getName()); } } ImmutableManagementResourceRegistration registration = context.getResourceRegistration(); for (String name : registration.getAttributeNames(PathAddress.EMPTY_ADDRESS)) { AttributeAccess attributeAccess = registration.getAttributeAccess(PathAddress.EMPTY_ADDRESS, name); if (attributeAccess != null) { AttributeDefinition attribute = attributeAccess.getAttributeDefinition(); if (attribute != null) { if (attribute.hasCapabilityRequirements()) { attribute.removeCapabilityRequirements(context, resource, model.get(attribute.getName())); } } } } for (Map.Entry<CapabilityReferenceRecorder, Function<PathAddress, String>> entry : this.descriptor.getResourceCapabilityReferences().entrySet()) { entry.getKey().removeCapabilityRequirements(context, resource, null, entry.getValue().apply(address)); } if (this.requiresRuntime(context)) { for (RuntimeResourceRegistration runtimeRegistration : this.descriptor.getRuntimeResourceRegistrations()) { runtimeRegistration.unregister(context); } } } super.performRemove(context, operation, model); }