jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject [24/50] jena git commit: Use Iterator.forEachRemaining.
Date Tue, 14 Feb 2017 14:39:39 GMT
Use Iterator.forEachRemaining.

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/4a05c045
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/4a05c045
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/4a05c045

Branch: refs/heads/ThreadPerGraphDataset
Commit: 4a05c045194e90929ff77b8c75f77cf1fca4b286
Parents: 3bbf5a1
Author: Andy Seaborne <andy@apache.org>
Authored: Thu Feb 2 22:17:35 2017 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Thu Feb 2 22:17:35 2017 +0000

----------------------------------------------------------------------
 .../src/main/java/org/apache/jena/graph/GraphUtil.java  | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/4a05c045/jena-core/src/main/java/org/apache/jena/graph/GraphUtil.java
----------------------------------------------------------------------
diff --git a/jena-core/src/main/java/org/apache/jena/graph/GraphUtil.java b/jena-core/src/main/java/org/apache/jena/graph/GraphUtil.java
index ef6dc08..9286c14 100644
--- a/jena-core/src/main/java/org/apache/jena/graph/GraphUtil.java
+++ b/jena-core/src/main/java/org/apache/jena/graph/GraphUtil.java
@@ -150,11 +150,9 @@ public class GraphUtil
     private static void addIteratorWorkerDirect( Graph graph, Iterator<Triple> it )
{
         if ( OldStyle && graph instanceof GraphWithPerform ) {
             GraphWithPerform g = (GraphWithPerform)graph;
-            while (it.hasNext())
-                g.performAdd(it.next());
+            it.forEachRemaining(g::performAdd);
         } else {
-            while (it.hasNext())
-                graph.add(it.next());
+            it.forEachRemaining(graph::add);
         }
     }
 
@@ -230,11 +228,9 @@ public class GraphUtil
     private static void deleteIteratorWorkerDirect(Graph graph, Iterator<Triple> it)
{
         if ( OldStyle && graph instanceof GraphWithPerform ) {
             GraphWithPerform g = (GraphWithPerform)graph ;
-            while(it.hasNext())
-                g.performDelete(it.next()) ;
+            it.forEachRemaining(g::performDelete);
         } else {
-            while(it.hasNext())
-                graph.delete(it.next());
+            it.forEachRemaining(graph::delete);
         }
     }
 


Mime
View raw message