polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [45/50] [abbrv] zest-qi4j git commit: Replacing loop with Stream API.
Date Fri, 17 Apr 2015 16:08:57 GMT
Replacing loop with Stream API.


Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/1dfbffce
Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/1dfbffce
Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/1dfbffce

Branch: refs/heads/3.0
Commit: 1dfbffcef1337352d6397793c08633dc91657a24
Parents: 61280dc
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Sat Oct 4 15:09:32 2014 +0800
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Sat Oct 4 15:09:32 2014 +0800

----------------------------------------------------------------------
 .../qi4j/api/dataset/iterable/IterableDataSet.java    |  6 +++---
 .../org/qi4j/api/dataset/iterable/IterableQuery.java  |  2 +-
 .../org/qi4j/api/object/NoSuchObjectException.java    |  3 +--
 .../main/java/org/qi4j/api/object/ObjectFactory.java  |  2 +-
 .../org/qi4j/api/property/GenericPropertyInfo.java    | 14 +++++---------
 5 files changed, 11 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/1dfbffce/core/api/src/main/java/org/qi4j/api/dataset/iterable/IterableDataSet.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/dataset/iterable/IterableDataSet.java b/core/api/src/main/java/org/qi4j/api/dataset/iterable/IterableDataSet.java
index 213763b..b31c29a 100644
--- a/core/api/src/main/java/org/qi4j/api/dataset/iterable/IterableDataSet.java
+++ b/core/api/src/main/java/org/qi4j/api/dataset/iterable/IterableDataSet.java
@@ -22,18 +22,18 @@ public class IterableDataSet<T>
     @Override
     public DataSet<T> constrain( Predicate<T> selection )
     {
-        return new IterableDataSet<T>( Iterables.filter( selection, iterable ) );
+        return new IterableDataSet<>( Iterables.filter( selection, iterable ) );
     }
 
     @Override
     public <U> DataSet<U> project( Function<T, U> conversion )
     {
-        return new IterableDataSet<U>( Iterables.map( conversion, iterable ) );
+        return new IterableDataSet<>( Iterables.map( conversion, iterable ) );
     }
 
     @Override
     public Query<T> newQuery()
     {
-        return new IterableQuery<T>( iterable );
+        return new IterableQuery<>( iterable );
     }
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/1dfbffce/core/api/src/main/java/org/qi4j/api/dataset/iterable/IterableQuery.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/dataset/iterable/IterableQuery.java b/core/api/src/main/java/org/qi4j/api/dataset/iterable/IterableQuery.java
index 7e67184..29451ca 100644
--- a/core/api/src/main/java/org/qi4j/api/dataset/iterable/IterableQuery.java
+++ b/core/api/src/main/java/org/qi4j/api/dataset/iterable/IterableQuery.java
@@ -17,7 +17,7 @@ public class IterableQuery<T> implements Query<T>
     private Iterable<T> iterable;
     private int skip;
     private int limit;
-    private Map<String, Object> variables = new HashMap<String, Object>();
+    private Map<String, Object> variables = new HashMap<>();
 
     public IterableQuery( Iterable<T> iterable )
     {

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/1dfbffce/core/api/src/main/java/org/qi4j/api/object/NoSuchObjectException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/object/NoSuchObjectException.java b/core/api/src/main/java/org/qi4j/api/object/NoSuchObjectException.java
index 71a4cb7..6f61c48 100644
--- a/core/api/src/main/java/org/qi4j/api/object/NoSuchObjectException.java
+++ b/core/api/src/main/java/org/qi4j/api/object/NoSuchObjectException.java
@@ -28,8 +28,7 @@ public class NoSuchObjectException
 
     public NoSuchObjectException( String type, String moduleName )
     {
-        super( "Could not find any visible Object of type [" + type + "] in module [" +
-               moduleName + "]." );
+        super( "Could not find any visible Object of type [" + type + "] in module [" + moduleName
+ "]." );
         this.objectType = type;
         this.moduleName = moduleName;
     }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/1dfbffce/core/api/src/main/java/org/qi4j/api/object/ObjectFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/object/ObjectFactory.java b/core/api/src/main/java/org/qi4j/api/object/ObjectFactory.java
index 9b8ec47..19905b6 100644
--- a/core/api/src/main/java/org/qi4j/api/object/ObjectFactory.java
+++ b/core/api/src/main/java/org/qi4j/api/object/ObjectFactory.java
@@ -37,7 +37,7 @@ public interface ObjectFactory
     /**
      * Inject an existing instance. Only fields and methods will be called.
      *
-     * @param instance
+     * @param instance The object that should receive the injections.
      *
      * @throws ConstructionException
      */

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/1dfbffce/core/api/src/main/java/org/qi4j/api/property/GenericPropertyInfo.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/property/GenericPropertyInfo.java b/core/api/src/main/java/org/qi4j/api/property/GenericPropertyInfo.java
index b8b9467..54ab32c 100644
--- a/core/api/src/main/java/org/qi4j/api/property/GenericPropertyInfo.java
+++ b/core/api/src/main/java/org/qi4j/api/property/GenericPropertyInfo.java
@@ -20,6 +20,7 @@ package org.qi4j.api.property;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
+import java.util.Arrays;
 
 import static org.qi4j.api.util.Classes.typeOf;
 
@@ -46,15 +47,10 @@ public final class GenericPropertyInfo
 
         if( methodReturnType instanceof Class<?> )
         {
-            Type[] interfaces = ( (Class<?>) methodReturnType ).getGenericInterfaces();
-            for( Type anInterface : interfaces )
-            {
-                Type propertyType = toPropertyType( anInterface );
-                if( propertyType != null )
-                {
-                    return propertyType;
-                }
-            }
+            Arrays.stream( ( (Class<?>) methodReturnType ).getGenericInterfaces() )
+                .map( GenericPropertyInfo::toPropertyType )
+                .filter( propType -> propType != null )
+                .findFirst();
         }
         return null;
     }


Mime
View raw message