Use Optional.isEmpty()
[yangtools.git] / data / yang-data-tree-ri / src / main / java / org / opendaylight / yangtools / yang / data / tree / impl / AbstractNodeContainerModificationStrategy.java
index 5a43bfdd28e996eaf24ffd8ce8626b24c0fcb9f5..3c5879228f831efbc127142a4f7bb38c1ba7d878 100644 (file)
@@ -354,13 +354,13 @@ abstract sealed class AbstractNodeContainerModificationStrategy<T extends DataSc
     protected final void checkTouchApplicable(final ModificationPath path, final NodeModification modification,
             final Optional<? extends TreeNode> current, final Version version) throws DataValidationFailedException {
         final TreeNode currentNode;
-        if (!current.isPresent()) {
+        if (current.isEmpty()) {
             currentNode = defaultTreeNode();
             if (currentNode == null) {
-                if (!modification.getOriginal().isPresent()) {
+                if (modification.getOriginal().isEmpty()) {
                     final YangInstanceIdentifier id = path.toInstanceIdentifier();
                     throw new ModifiedNodeDoesNotExistException(id,
-                        String.format("Node %s does not exist. Cannot apply modification to its children.", id));
+                        "Node " + id + " does not exist. Cannot apply modification to its children.");
                 }
 
                 throw new ConflictingModificationAppliedException(path.toInstanceIdentifier(),