diff options
author | Valerij Fredriksen <valerijf@verizonmedia.com> | 2020-01-18 16:30:40 +0100 |
---|---|---|
committer | Valerij Fredriksen <valerijf@verizonmedia.com> | 2020-01-19 10:38:07 +0100 |
commit | ce4dc6eb49f6a728bced7beb17813b2ac9bb2050 (patch) | |
tree | fea0fb38a9fb250597b5b54aaa6eac7f2c41fe4d /node-admin | |
parent | 1ce2696019f99e51cecb150e1082b049f210dd9f (diff) |
Use Optional::isEmpty
Diffstat (limited to 'node-admin')
6 files changed, 10 insertions, 10 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java index fdb9428dc3f..68178418e62 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java @@ -428,7 +428,7 @@ public class NodeAgentImpl implements NodeAgent { } container = removeContainerIfNeededUpdateContainerState(context, container); credentialsMaintainer.ifPresent(maintainer -> maintainer.converge(context)); - if (! container.isPresent()) { + if (container.isEmpty()) { containerState = STARTING; startContainer(context); containerState = UNKNOWN; @@ -497,7 +497,7 @@ public class NodeAgentImpl implements NodeAgent { private Optional<Container> getContainer(NodeAgentContext context) { if (containerState == ABSENT) return Optional.empty(); Optional<Container> container = dockerOperations.getContainer(context); - if (! container.isPresent()) containerState = ABSENT; + if (container.isEmpty()) containerState = ABSENT; return container; } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/editor/CursorImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/editor/CursorImpl.java index 22972a9f15b..f5b5c8ae31e 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/editor/CursorImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/editor/CursorImpl.java @@ -306,7 +306,7 @@ public class CursorImpl implements Cursor { @Override public boolean replaceMatch(Pattern pattern, Function<Match, String> replacer) { Optional<Match> match = moveForwardToStartOfMatch(pattern); - if (!match.isPresent()) { + if (match.isEmpty()) { return false; } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/AttributeSync.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/AttributeSync.java index 16eb1a9b509..a781615e44d 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/AttributeSync.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/AttributeSync.java @@ -101,7 +101,7 @@ public class AttributeSync { Optional<String> wantedValue, Supplier<String> currentValueSupplier, Consumer<String> valueSetter) { - if (!wantedValue.isPresent()) { + if (wantedValue.isEmpty()) { return false; } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ChildProcess2Impl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ChildProcess2Impl.java index 2854dc55af8..0c03dc7f483 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ChildProcess2Impl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ChildProcess2Impl.java @@ -89,7 +89,7 @@ public class ChildProcess2Impl implements ChildProcess2 { @Override public void close() { try { - if ( ! commandLine.getOutputFile().isPresent()) + if (commandLine.getOutputFile().isEmpty()) Files.delete(outputPath); } catch (Throwable t) { logger.log(LogLevel.WARNING, "Failed to delete " + outputPath, t); diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ProcessFactoryImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ProcessFactoryImpl.java index a5f8e667ff2..dbe6b984211 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ProcessFactoryImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/ProcessFactoryImpl.java @@ -85,7 +85,7 @@ public class ProcessFactoryImpl implements ProcessFactory { return new ChildProcess2Impl(commandLine, process, outputFile, timer); } catch (RuntimeException | Error throwable) { try { - if ( ! commandLine.getOutputFile().isPresent()) + if (commandLine.getOutputFile().isEmpty()) Files.delete(outputFile); } catch (IOException ioException) { logger.log(LogLevel.WARNING, "Failed to delete temporary file at " + diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/YumPackageName.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/YumPackageName.java index fb85815c70f..54c8719bceb 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/YumPackageName.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/yum/YumPackageName.java @@ -244,10 +244,10 @@ public class YumPackageName { public boolean isSubsetOf(YumPackageName other) { return Objects.equals(name, other.name) && - (!epoch.isPresent() || Objects.equals(epoch, other.epoch)) && - (!version.isPresent() || Objects.equals(version, other.version)) && - (!release.isPresent() || Objects.equals(release, other.release)) && - (!architecture.isPresent() || Objects.equals(architecture, other.architecture)); + (epoch.isEmpty() || Objects.equals(epoch, other.epoch)) && + (version.isEmpty() || Objects.equals(version, other.version)) && + (release.isEmpty() || Objects.equals(release, other.release)) && + (architecture.isEmpty() || Objects.equals(architecture, other.architecture)); } @Override |