freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [3/5] incubator-freemarker git commit: Removed an unnecessary sync in SimpleCollection
Date Fri, 03 Mar 2017 21:19:50 GMT
Removed an unnecessary sync in SimpleCollection


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/9f1fea3e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/9f1fea3e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/9f1fea3e

Branch: refs/heads/2.3-gae
Commit: 9f1fea3ed7671c3d6f71ffd8d4ac1365764a7caf
Parents: b4035ce
Author: ddekany <ddekany@apache.org>
Authored: Fri Mar 3 11:34:42 2017 +0100
Committer: ddekany <ddekany@apache.org>
Committed: Fri Mar 3 11:34:42 2017 +0100

----------------------------------------------------------------------
 src/main/java/freemarker/template/SimpleCollection.java | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/9f1fea3e/src/main/java/freemarker/template/SimpleCollection.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/template/SimpleCollection.java b/src/main/java/freemarker/template/SimpleCollection.java
index ebcd679..aa67ef1 100644
--- a/src/main/java/freemarker/template/SimpleCollection.java
+++ b/src/main/java/freemarker/template/SimpleCollection.java
@@ -85,13 +85,9 @@ implements TemplateCollectionModel, Serializable {
      * can't return the first element anymore.
      */
     public TemplateModelIterator iterator() {
-        if (iterator != null) {
-            return new SimpleTemplateModelIterator(iterator, false);
-        } else {
-            synchronized (collection) {
-                return new SimpleTemplateModelIterator(collection.iterator(), true);
-            }
-        }
+        return iterator != null
+                ? new SimpleTemplateModelIterator(iterator, false)
+                : new SimpleTemplateModelIterator(collection.iterator(), true);
     }
     
     /**


Mime
View raw message