We can skip allocation of an Optional by using nullable return with a
check.
Change-Id: I78cf3316d8d026b32ecb94ece77ae637444d5bb0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
static @Nullable DataSchemaContextNode<?> fromAugmentation(final DataNodeContainer parent,
final AugmentationTarget parentAug, final DataSchemaNode child) {
for (AugmentationSchemaNode aug : parentAug.getAvailableAugmentations()) {
static @Nullable DataSchemaContextNode<?> fromAugmentation(final DataNodeContainer parent,
final AugmentationTarget parentAug, final DataSchemaNode child) {
for (AugmentationSchemaNode aug : parentAug.getAvailableAugmentations()) {
- if (aug.findDataChildByName(child.getQName()).isPresent()) {
+ if (aug.dataChildByName(child.getQName()) != null) {
return new AugmentationContextNode(aug, parent);
}
}
return new AugmentationContextNode(aug, parent);
}
}
}
for (final AugmentationSchemaNode augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) {
}
for (final AugmentationSchemaNode augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) {
- final Optional<DataSchemaNode> childInAugmentation = augmentation.findDataChildByName(child.getQName());
- if (childInAugmentation.isPresent()) {
+ if (augmentation.dataChildByName(child.getQName()) != null) {
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
-import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.NonNull;
import java.util.Set;
import java.util.stream.Collectors;
import org.eclipse.jdt.annotation.NonNull;
// FIXME: 7.0.0: can we get rid of this?
private static SchemaNode findCaseByChild(final ChoiceSchemaNode parent, final QName qname) {
for (final CaseSchemaNode caze : parent.getCases()) {
// FIXME: 7.0.0: can we get rid of this?
private static SchemaNode findCaseByChild(final ChoiceSchemaNode parent, final QName qname) {
for (final CaseSchemaNode caze : parent.getCases()) {
- final Optional<DataSchemaNode> potential = caze.findDataChildByName(qname);
- if (potential.isPresent()) {
+ if (caze.dataChildByName(qname) != null) {