8274464: Remove redundant stream() call before forEach in java.* modules

Reviewed-by: dfuchs, amenkov, vtewari
This commit is contained in:
Andrey Turbanov 2021-10-06 18:11:07 +00:00 committed by Daniel Fuchs
parent c10de3538b
commit f3cedbe928
4 changed files with 5 additions and 8 deletions

View file

@ -119,7 +119,7 @@ public class RMIJRMPServerImpl extends RMIServerImpl {
else if (credentialsTypes != null) { else if (credentialsTypes != null) {
allowedTypes = Arrays.stream(credentialsTypes).filter( allowedTypes = Arrays.stream(credentialsTypes).filter(
s -> s!= null).collect(Collectors.toSet()); s -> s!= null).collect(Collectors.toSet());
allowedTypes.stream().forEach(ReflectUtil::checkPackageAccess); allowedTypes.forEach(ReflectUtil::checkPackageAccess);
cFilter = this::newClientCheckInput; cFilter = this::newClientCheckInput;
} else { } else {
allowedTypes = null; allowedTypes = null;

View file

@ -416,8 +416,7 @@ class DefaultPlatformMBeanProvider extends PlatformMBeanProvider {
map = Collections.<String, BufferPoolMXBean>emptyMap(); map = Collections.<String, BufferPoolMXBean>emptyMap();
} else { } else {
map = new HashMap<>(list.size()); map = new HashMap<>(list.size());
list.stream() list.forEach(mbean -> map.put(mbean.getObjectName().getCanonicalName(),mbean));
.forEach(mbean -> map.put(mbean.getObjectName().getCanonicalName(),mbean));
} }
return map; return map;
} }

View file

@ -576,9 +576,7 @@ public class CatalogFeatures {
* @param builder the CatalogFeatures builder * @param builder the CatalogFeatures builder
*/ */
private void setProperties(Builder builder) { private void setProperties(Builder builder) {
builder.values.entrySet().stream().forEach((entry) -> { builder.values.forEach((feature, value) -> setProperty(feature, State.APIPROPERTY, value));
setProperty(entry.getKey(), State.APIPROPERTY, entry.getValue());
});
} }
/** /**
* Sets the value of a property, updates only if it shall override. * Sets the value of a property, updates only if it shall override.

View file

@ -413,14 +413,14 @@ class CatalogImpl extends GroupEntry implements Catalog {
void loadNextCatalogs() { void loadNextCatalogs() {
//loads catalogs specified in nextCatalogs //loads catalogs specified in nextCatalogs
if (nextCatalogs != null) { if (nextCatalogs != null) {
nextCatalogs.stream().forEach((next) -> { nextCatalogs.forEach((next) -> {
getCatalog(this, next.getCatalogURI()); getCatalog(this, next.getCatalogURI());
}); });
} }
//loads catalogs from the input list //loads catalogs from the input list
if (inputFiles != null) { if (inputFiles != null) {
inputFiles.stream().forEach((uri) -> { inputFiles.forEach((uri) -> {
getCatalog(null, URI.create(uri)); getCatalog(null, URI.create(uri));
}); });
} }