jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rve...@apache.org
Subject [11/50] [abbrv] jena git commit: Common idiom.
Date Wed, 10 Feb 2016 10:00:46 GMT
Common idiom.

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

Branch: refs/heads/JENA-507
Commit: 3150226ab8c8bfdce237a3d55b3bd45b07de1b3b
Parents: 8365452
Author: Andy Seaborne <andy@apache.org>
Authored: Sat Jan 9 17:38:47 2016 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Sat Jan 9 17:38:47 2016 +0000

----------------------------------------------------------------------
 .../main/java/org/apache/jena/atlas/lib/ListUtils.java   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/3150226a/jena-base/src/main/java/org/apache/jena/atlas/lib/ListUtils.java
----------------------------------------------------------------------
diff --git a/jena-base/src/main/java/org/apache/jena/atlas/lib/ListUtils.java b/jena-base/src/main/java/org/apache/jena/atlas/lib/ListUtils.java
index e7237e8..200b836 100644
--- a/jena-base/src/main/java/org/apache/jena/atlas/lib/ListUtils.java
+++ b/jena-base/src/main/java/org/apache/jena/atlas/lib/ListUtils.java
@@ -20,10 +20,12 @@ package org.apache.jena.atlas.lib;
 
 import static java.util.Arrays.stream;
 import static java.util.stream.Collectors.joining;
-import static java.util.stream.Collectors.toList;
 
 import java.util.ArrayList ;
 import java.util.List ;
+import java.util.stream.Collectors ;
+import java.util.stream.Stream ;
+
 import org.apache.jena.atlas.io.IndentedWriter ;
 import org.apache.jena.atlas.logging.Log ;
 
@@ -35,7 +37,7 @@ public class ListUtils
     public static <T>
     List<T> unique(List<T> list)
     {
-    		return list.stream().distinct().collect(toList());
+    		return toList(list.stream().distinct()) ;
     }
     
     public static
@@ -47,6 +49,11 @@ public class ListUtils
         return x ;
     }
     
+    // This is commonly needed
+    public static <T> List<T> toList(Stream<T> stream) {
+        return stream.collect(Collectors.toList()) ;
+    }
+    
     public static <T> String str(T[] array)
     {
         return stream(array).map(String::valueOf).collect(joining(", ", "[", "]"));


Mime
View raw message