From 8f1873121e6e97b56d2932a5c8a417e7889e3cd9 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Sat, 10 Oct 2020 21:55:51 +0100 Subject: [PATCH] HHH-10715 Use the more efficient iterators --- .../hibernate/envers/internal/tools/query/UpdateBuilder.java | 5 +++-- .../src/main/java/org/hibernate/osgi/OsgiServiceUtil.java | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/internal/tools/query/UpdateBuilder.java b/hibernate-envers/src/main/java/org/hibernate/envers/internal/tools/query/UpdateBuilder.java index a5148cf419..5426d4724a 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/internal/tools/query/UpdateBuilder.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/internal/tools/query/UpdateBuilder.java @@ -47,10 +47,11 @@ public class UpdateBuilder { sb.append( "update " ).append( entityName ).append( " " ).append( alias ); sb.append( " set " ); int i = 1; - for ( String property : updates.keySet() ) { + for ( java.util.Map.Entry entry : updates.entrySet() ) { + final String property = entry.getKey(); final String paramName = generateParameterName(); sb.append( alias ).append( "." ).append( property ).append( " = " ).append( ":" ).append( paramName ); - updateParamValues.put( paramName, updates.get( property ) ); + updateParamValues.put( paramName, entry.getValue() ); if ( i < updates.size() ) { sb.append( ", " ); } diff --git a/hibernate-osgi/src/main/java/org/hibernate/osgi/OsgiServiceUtil.java b/hibernate-osgi/src/main/java/org/hibernate/osgi/OsgiServiceUtil.java index febdeeb6d9..915584ae20 100644 --- a/hibernate-osgi/src/main/java/org/hibernate/osgi/OsgiServiceUtil.java +++ b/hibernate-osgi/src/main/java/org/hibernate/osgi/OsgiServiceUtil.java @@ -87,8 +87,8 @@ public class OsgiServiceUtil implements Stoppable { @Override public void stop() { - for (String key : serviceTrackers.keySet()) { - serviceTrackers.get( key ).close(); + for ( java.util.Map.Entry entry : serviceTrackers.entrySet() ) { + entry.getValue().close(); } serviceTrackers.clear(); }