< prev index next >
src/java.management/share/classes/java/lang/management/ManagementFactory.java
Print this page
rev 14279 : [mq]: 8140281-deprecation-optional.get
@@ -941,11 +941,11 @@
.stream()
.filter(pc -> pc.mbeanInterfaceNames().contains(name))
.findFirst();
if (op.isPresent()) {
- return op.get();
+ return op.getWhenPresent();
} else {
return null;
}
}
@@ -964,11 +964,11 @@
} else {
return p1;
}
});
- PlatformComponent<?> singleton = op.isPresent() ? op.get() : null;
+ PlatformComponent<?> singleton = op.isPresent() ? op.getWhenPresent() : null;
if (singleton == null) {
throw new IllegalArgumentException(mbeanIntf.getName() +
" is not a platform management interface");
}
if (!singleton.isSingleton()) {
< prev index next >