You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polygene.apache.org by ni...@apache.org on 2015/04/17 18:08:39 UTC

[27/50] [abbrv] zest-qi4j git commit: Removed Function, Function2 and Specification and replaced with the equivalents in JDK, Function, BiFunction and Predicate.

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/service/qualifier/ServiceQualifier.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/service/qualifier/ServiceQualifier.java b/core/api/src/main/java/org/qi4j/api/service/qualifier/ServiceQualifier.java
index 75410d6..9f5318e 100644
--- a/core/api/src/main/java/org/qi4j/api/service/qualifier/ServiceQualifier.java
+++ b/core/api/src/main/java/org/qi4j/api/service/qualifier/ServiceQualifier.java
@@ -14,8 +14,8 @@
 
 package org.qi4j.api.service.qualifier;
 
+import java.util.function.Predicate;
 import org.qi4j.api.service.ServiceReference;
-import org.qi4j.functional.Specification;
 
 /**
  * This class helps you select a particular service
@@ -42,13 +42,13 @@ import org.qi4j.functional.Specification;
  */
 public abstract class ServiceQualifier
 {
-    public static <T> T firstService( Specification<ServiceReference<?>> qualifier,
+    public static <T> T firstService( Predicate<ServiceReference<?>> qualifier,
                                       Iterable<ServiceReference<T>> services
     )
     {
         for( ServiceReference<T> service : services )
         {
-            if( qualifier.satisfiedBy( service ) )
+            if( qualifier.test( service ) )
             {
                 return service.get();
             }
@@ -56,24 +56,24 @@ public abstract class ServiceQualifier
         return null;
     }
 
-    public static Specification<ServiceReference<?>> withId( final String anId )
+    public static Predicate<ServiceReference<?>> withId( final String anId )
     {
-        return new Specification<ServiceReference<?>>()
+        return new Predicate<ServiceReference<?>>()
         {
             @Override
-            public boolean satisfiedBy( ServiceReference<?> service )
+            public boolean test( ServiceReference<?> service )
             {
                 return service.identity().equals( anId );
             }
         };
     }
 
-    public static Specification<ServiceReference<?>> whereMetaInfoIs( final Object metaInfo )
+    public static Predicate<ServiceReference<?>> whereMetaInfoIs( final Object metaInfo )
     {
-        return new Specification<ServiceReference<?>>()
+        return new Predicate<ServiceReference<?>>()
         {
             @Override
-            public boolean satisfiedBy( ServiceReference<?> service )
+            public boolean test( ServiceReference<?> service )
             {
                 Object metaObject = service.metaInfo( metaInfo.getClass() );
                 return metaObject != null && metaInfo.equals( metaObject );
@@ -81,36 +81,36 @@ public abstract class ServiceQualifier
         };
     }
 
-    public static Specification<ServiceReference<?>> whereActive()
+    public static Predicate<ServiceReference<?>> whereActive()
     {
-        return new Specification<ServiceReference<?>>()
+        return new Predicate<ServiceReference<?>>()
         {
             @Override
-            public boolean satisfiedBy( ServiceReference<?> service )
+            public boolean test( ServiceReference<?> service )
             {
                 return service.isActive();
             }
         };
     }
 
-    public static Specification<ServiceReference<?>> whereAvailable()
+    public static Predicate<ServiceReference<?>> whereAvailable()
     {
-        return new Specification<ServiceReference<?>>()
+        return new Predicate<ServiceReference<?>>()
         {
             @Override
-            public boolean satisfiedBy( ServiceReference<?> service )
+            public boolean test( ServiceReference<?> service )
             {
                 return service.isAvailable();
             }
         };
     }
 
-    public static Specification<ServiceReference<?>> withTags( final String... tags )
+    public static Predicate<ServiceReference<?>> withTags( final String... tags )
     {
-        return new Specification<ServiceReference<?>>()
+        return new Predicate<ServiceReference<?>>()
         {
             @Override
-            public boolean satisfiedBy( ServiceReference<?> service )
+            public boolean test( ServiceReference<?> service )
             {
                 ServiceTags serviceTags = service.metaInfo( ServiceTags.class );
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/service/qualifier/Tagged.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/service/qualifier/Tagged.java b/core/api/src/main/java/org/qi4j/api/service/qualifier/Tagged.java
index 3c8c0b7..7046bd2 100644
--- a/core/api/src/main/java/org/qi4j/api/service/qualifier/Tagged.java
+++ b/core/api/src/main/java/org/qi4j/api/service/qualifier/Tagged.java
@@ -16,8 +16,8 @@ package org.qi4j.api.service.qualifier;
 
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
+import java.util.function.Predicate;
 import org.qi4j.api.service.ServiceReference;
-import org.qi4j.functional.Specification;
 
 /**
  * Filter services based on tags. Tags can be set using the ServiceTags meta-info, like so:
@@ -46,7 +46,7 @@ public @interface Tagged
         implements AnnotationQualifier<Tagged>
     {
         @Override
-        public Specification<ServiceReference<?>> qualifier( Tagged tagged )
+        public Predicate<ServiceReference<?>> qualifier( Tagged tagged )
         {
             return ServiceQualifier.withTags( tagged.value() );
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/type/CollectionType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/type/CollectionType.java b/core/api/src/main/java/org/qi4j/api/type/CollectionType.java
index 1b85b5f..447c07a 100644
--- a/core/api/src/main/java/org/qi4j/api/type/CollectionType.java
+++ b/core/api/src/main/java/org/qi4j/api/type/CollectionType.java
@@ -29,7 +29,7 @@ public final class CollectionType
 
     public static boolean isCollection( Type type )
     {
-        Class<?> cl = Classes.RAW_CLASS.map( type );
+        Class<?> cl = Classes.RAW_CLASS.apply( type );
         return cl.equals( Collection.class ) || cl.equals( List.class ) || cl.equals( Set.class );
     }
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/type/MapType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/type/MapType.java b/core/api/src/main/java/org/qi4j/api/type/MapType.java
index ddf03c5..4b67ee7 100644
--- a/core/api/src/main/java/org/qi4j/api/type/MapType.java
+++ b/core/api/src/main/java/org/qi4j/api/type/MapType.java
@@ -30,7 +30,7 @@ public final class MapType
 
     public static boolean isMap( Type type )
     {
-        Class<?> cl = Classes.RAW_CLASS.map( type );
+        Class<?> cl = Classes.RAW_CLASS.apply( type );
         return Map.class.isAssignableFrom( cl );
     }
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/type/MatchTypeSpecification.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/type/MatchTypeSpecification.java b/core/api/src/main/java/org/qi4j/api/type/MatchTypeSpecification.java
index ff7e8e5..ec168df 100644
--- a/core/api/src/main/java/org/qi4j/api/type/MatchTypeSpecification.java
+++ b/core/api/src/main/java/org/qi4j/api/type/MatchTypeSpecification.java
@@ -16,13 +16,13 @@
 
 package org.qi4j.api.type;
 
-import org.qi4j.functional.Specification;
+import java.util.function.Predicate;
 
 /**
  * Match Type Specification for HasTypes.
  */
 public class MatchTypeSpecification
-    implements Specification<HasTypes>
+    implements Predicate<HasTypes>
 {
     private final Class<?> matchType;
 
@@ -32,7 +32,7 @@ public class MatchTypeSpecification
     }
 
     @Override
-    public boolean satisfiedBy( HasTypes item )
+    public boolean test( HasTypes item )
     {
         for( Class<?> type : item.types() )
         {

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/type/ValueCompositeType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/type/ValueCompositeType.java b/core/api/src/main/java/org/qi4j/api/type/ValueCompositeType.java
index c546625..cb74c9d 100644
--- a/core/api/src/main/java/org/qi4j/api/type/ValueCompositeType.java
+++ b/core/api/src/main/java/org/qi4j/api/type/ValueCompositeType.java
@@ -30,7 +30,7 @@ public final class ValueCompositeType
 
     public static boolean isValueComposite( Type type )
     {
-        return ValueComposite.class.isAssignableFrom( Classes.RAW_CLASS.map( type ) );
+        return ValueComposite.class.isAssignableFrom( Classes.RAW_CLASS.apply( type ) );
     }
 
     public ValueCompositeType( ValueDescriptor model )

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/type/ValueType.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/type/ValueType.java b/core/api/src/main/java/org/qi4j/api/type/ValueType.java
index ede914c..5cb4db4 100644
--- a/core/api/src/main/java/org/qi4j/api/type/ValueType.java
+++ b/core/api/src/main/java/org/qi4j/api/type/ValueType.java
@@ -15,8 +15,8 @@
 package org.qi4j.api.type;
 
 import java.util.Collections;
+import java.util.function.Function;
 import org.qi4j.api.util.NullArgumentException;
-import org.qi4j.functional.Function;
 import org.qi4j.functional.Iterables;
 
 import static org.qi4j.functional.Iterables.first;
@@ -138,7 +138,7 @@ public class ValueType
             new Function<Class<?>, String>()
             {
                 @Override
-                public String map( Class<?> item )
+                public String apply( Class<?> item )
                 {
                     return item.getName();
                 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/unitofwork/NoSuchEntityException.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/unitofwork/NoSuchEntityException.java b/core/api/src/main/java/org/qi4j/api/unitofwork/NoSuchEntityException.java
index aff3bfa..3a43ade 100644
--- a/core/api/src/main/java/org/qi4j/api/unitofwork/NoSuchEntityException.java
+++ b/core/api/src/main/java/org/qi4j/api/unitofwork/NoSuchEntityException.java
@@ -13,8 +13,8 @@
  */
 package org.qi4j.api.unitofwork;
 
+import java.util.function.Function;
 import org.qi4j.api.entity.EntityReference;
-import org.qi4j.functional.Function;
 import org.qi4j.functional.Iterables;
 
 /**
@@ -67,7 +67,7 @@ public class NoSuchEntityException
         Iterable<String> map = Iterables.map( new Function<Class<?>, String>()
         {
             @Override
-            public String map( Class<?> item )
+            public String apply( Class<?> item )
             {
                 return item.getName();
             }
@@ -83,7 +83,7 @@ public class NoSuchEntityException
             }
 
             @Override
-            public String map( String strings )
+            public String apply( String strings )
             {
                 if( !first )
                 {

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/util/Annotations.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/util/Annotations.java b/core/api/src/main/java/org/qi4j/api/util/Annotations.java
index 8adc5ff..a770632 100644
--- a/core/api/src/main/java/org/qi4j/api/util/Annotations.java
+++ b/core/api/src/main/java/org/qi4j/api/util/Annotations.java
@@ -18,9 +18,9 @@ import java.lang.annotation.Annotation;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.AnnotatedElement;
 import java.lang.reflect.Type;
-import org.qi4j.functional.Function;
+import java.util.function.Function;
+import java.util.function.Predicate;
 import org.qi4j.functional.Iterables;
-import org.qi4j.functional.Specification;
 
 import static org.qi4j.api.util.Classes.interfacesOf;
 import static org.qi4j.api.util.Classes.typeOf;
@@ -37,18 +37,18 @@ public final class Annotations
     public static Function<Type, Iterable<Annotation>> ANNOTATIONS_OF = Classes.forTypes( new Function<Type, Iterable<Annotation>>()
     {
         @Override
-        public Iterable<Annotation> map( Type type )
+        public Iterable<Annotation> apply( Type type )
         {
-            return Iterables.iterable( Classes.RAW_CLASS.map( type ).getAnnotations() );
+            return Iterables.iterable( Classes.RAW_CLASS.apply( type ).getAnnotations() );
         }
     } );
 
-    public static Specification<AnnotatedElement> hasAnnotation( final Class<? extends Annotation> annotationType )
+    public static Predicate<AnnotatedElement> hasAnnotation( final Class<? extends Annotation> annotationType )
     {
-        return new Specification<AnnotatedElement>()
+        return new Predicate<AnnotatedElement>()
         {
             @Override
-            public boolean satisfiedBy( AnnotatedElement element )
+            public boolean test( AnnotatedElement element )
             {
                 return element.getAnnotation( annotationType ) != null;
             }
@@ -60,19 +60,19 @@ public final class Annotations
         return new Function<Annotation, Class<? extends Annotation>>()
         {
             @Override
-            public Class<? extends Annotation> map( Annotation annotation )
+            public Class<? extends Annotation> apply( Annotation annotation )
             {
                 return annotation.annotationType();
             }
         };
     }
 
-    public static Specification<Annotation> isType( final Class<? extends Annotation> annotationType )
+    public static Predicate<Annotation> isType( final Class<? extends Annotation> annotationType )
     {
-        return new Specification<Annotation>()
+        return new Predicate<Annotation>()
         {
             @Override
-            public boolean satisfiedBy( Annotation annotation )
+            public boolean test( Annotation annotation )
             {
                 return annotation.annotationType().equals( annotationType );
             }
@@ -81,7 +81,7 @@ public final class Annotations
 
     public static <T extends Annotation> T annotationOn( Type type, Class<T> annotationType )
     {
-        return annotationType.cast( Classes.RAW_CLASS.map( type ).getAnnotation( annotationType ) );
+        return annotationType.cast( Classes.RAW_CLASS.apply( type ).getAnnotation( annotationType ) );
     }
 
     public static Iterable<Annotation> findAccessorAndTypeAnnotationsIn( AccessibleObject accessor )

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/util/Classes.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/util/Classes.java b/core/api/src/main/java/org/qi4j/api/util/Classes.java
index 9413f9e..807b4be 100644
--- a/core/api/src/main/java/org/qi4j/api/util/Classes.java
+++ b/core/api/src/main/java/org/qi4j/api/util/Classes.java
@@ -30,10 +30,10 @@ import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.function.Function;
+import java.util.function.Predicate;
 import org.qi4j.api.composite.ModelDescriptor;
-import org.qi4j.functional.Function;
 import org.qi4j.functional.Iterables;
-import org.qi4j.functional.Specification;
 
 import static org.qi4j.functional.Iterables.cast;
 import static org.qi4j.functional.Iterables.empty;
@@ -85,7 +85,7 @@ public final class Classes
     private static final Function<Type, Type> WRAPPER_CLASS = new Function<Type, Type>()
     {
         @Override
-        public Type map( Type aClass )
+        public Type apply( Type aClass )
         {
             Type wrapperClass = wrapperClasses.get( aClass );
             return wrapperClass == null ? aClass : wrapperClass;
@@ -100,7 +100,7 @@ public final class Classes
     private static final Function<Type, Type> PRIMITIVE_CLASS = new Function<Type, Type>()
     {
         @Override
-        public Type map( Type aClass )
+        public Type apply( Type aClass )
         {
             Type primitiveClass = primitiveClasses.get( aClass );
             return primitiveClass == null ? aClass : primitiveClass;
@@ -113,7 +113,7 @@ public final class Classes
     public static final Function<Type, Class<?>> RAW_CLASS = new Function<Type, Class<?>>()
     {
         @Override
-        public Class<?> map( Type genericType )
+        public Class<?> apply( Type genericType )
         {
             // Calculate raw type
             if( genericType instanceof Class )
@@ -144,7 +144,7 @@ public final class Classes
     private static final Function<AccessibleObject, Type> TYPE_OF = new Function<AccessibleObject, Type>()
     {
         @Override
-        public Type map( AccessibleObject accessor )
+        public Type apply( AccessibleObject accessor )
         {
             return accessor instanceof Method ? ( (Method) accessor ).getGenericReturnType() : ( (Field) accessor ).getGenericType();
         }
@@ -154,7 +154,7 @@ public final class Classes
     {
         @Override
         @SuppressWarnings( {"raw", "unchecked"} )
-        public Iterable<Class<?>> map( Type type )
+        public Iterable<Class<?>> apply( Type type )
         {
             if( type == null )
             {
@@ -167,9 +167,9 @@ public final class Classes
             }
             else
             {
-                type = RAW_CLASS.map( type );
+                type = RAW_CLASS.apply( type );
                 Class superclass = ( (Class) type ).getSuperclass();
-                return prepend( (Class<?>) type, map( superclass ) );
+                return prepend( (Class<?>) type, apply( superclass ) );
             }
         }
     };
@@ -178,9 +178,9 @@ public final class Classes
     private static final Function<Type, Iterable<Type>> INTERFACES_OF = new Function<Type, Iterable<Type>>()
     {
         @Override
-        public Iterable<Type> map( Type type )
+        public Iterable<Type> apply( Type type )
         {
-            Class clazz = RAW_CLASS.map( type );
+            Class clazz = RAW_CLASS.apply( type );
 
             if( clazz.isInterface() )
             {
@@ -198,7 +198,7 @@ public final class Classes
                 {
                     return flatten( flattenIterables( Iterables.map( INTERFACES_OF,
                                                                      iterable( clazz.getGenericInterfaces() ) ) ),
-                                    INTERFACES_OF.map( RAW_CLASS.map( type ).getSuperclass() ) );
+                                    INTERFACES_OF.apply( RAW_CLASS.apply( type ).getSuperclass() ) );
                 }
             }
         }
@@ -208,9 +208,9 @@ public final class Classes
     private static final Function<Type, Iterable<Type>> TYPES_OF = new Function<Type, Iterable<Type>>()
     {
         @Override
-        public Iterable<Type> map( Type type )
+        public Iterable<Type> apply( Type type )
         {
-            Class clazz = RAW_CLASS.map( type );
+            Class clazz = RAW_CLASS.apply( type );
 
             if( clazz.isInterface() )
             {
@@ -220,15 +220,15 @@ public final class Classes
             }
             else
             {
-                return flatten( CLASS_HIERARCHY.map( type ),
-                                flattenIterables( Iterables.map( INTERFACES_OF, CLASS_HIERARCHY.map( type ) ) ) );
+                return flatten( CLASS_HIERARCHY.apply( type ),
+                                flattenIterables( Iterables.map( INTERFACES_OF, CLASS_HIERARCHY.apply( type ) ) ) );
             }
         }
     };
 
     public static Type typeOf( AccessibleObject from )
     {
-        return TYPE_OF.map( from );
+        return TYPE_OF.apply( from );
     }
 
     public static Iterable<Type> typesOf( Iterable<Type> types )
@@ -243,7 +243,7 @@ public final class Classes
 
     public static Iterable<Type> typesOf( Type type )
     {
-        return TYPES_OF.map( type );
+        return TYPES_OF.apply( type );
     }
 
     public static Iterable<? extends Type> interfacesOf( Iterable<? extends Type> types )
@@ -258,26 +258,26 @@ public final class Classes
 
     public static Iterable<Type> interfacesOf( Type type )
     {
-        return INTERFACES_OF.map( type );
+        return INTERFACES_OF.apply( type );
     }
 
     public static Iterable<Class<?>> classHierarchy( Class<?> type )
     {
-        return CLASS_HIERARCHY.map( type );
+        return CLASS_HIERARCHY.apply( type );
     }
 
     public static Type wrapperClass( Type type )
     {
-        return WRAPPER_CLASS.map( type );
+        return WRAPPER_CLASS.apply( type );
     }
 
-    public static Specification<Class<?>> isAssignableFrom( final Class clazz )
+    public static Predicate<Class<?>> isAssignableFrom( final Class clazz )
     {
-        return new Specification<Class<?>>()
+        return new Predicate<Class<?>>()
         {
             @Override
             @SuppressWarnings( "unchecked" )
-            public boolean satisfiedBy( Class<?> item )
+            public boolean test( Class<?> item )
             {
                 return clazz.isAssignableFrom( item );
             }
@@ -285,24 +285,24 @@ public final class Classes
     }
 
     @SuppressWarnings( "raw" )
-    public static Specification<Object> instanceOf( final Class clazz )
+    public static Predicate<Object> instanceOf( final Class clazz )
     {
-        return new Specification<Object>()
+        return new Predicate<Object>()
         {
             @Override
-            public boolean satisfiedBy( Object item )
+            public boolean test( Object item )
             {
                 return clazz.isInstance( item );
             }
         };
     }
 
-    public static Specification<Class<?>> hasModifier( final int classModifier )
+    public static Predicate<Class<?>> hasModifier( final int classModifier )
     {
-        return new Specification<Class<?>>()
+        return new Predicate<Class<?>>()
         {
             @Override
-            public boolean satisfiedBy( Class<?> item )
+            public boolean test( Class<?> item )
             {
                 return ( item.getModifiers() & classModifier ) != 0;
             }
@@ -314,9 +314,9 @@ public final class Classes
         return new Function<Type, Iterable<T>>()
         {
             @Override
-            public Iterable<T> map( Type type )
+            public Iterable<T> apply( Type type )
             {
-                return flattenIterables( Iterables.map( function, CLASS_HIERARCHY.map( type ) ) );
+                return flattenIterables( Iterables.map( function, CLASS_HIERARCHY.apply( type ) ) );
             }
         };
     }
@@ -326,9 +326,9 @@ public final class Classes
         return new Function<Type, Iterable<T>>()
         {
             @Override
-            public Iterable<T> map( Type type )
+            public Iterable<T> apply( Type type )
             {
-                return flattenIterables( Iterables.map( function, TYPES_OF.map( type ) ) );
+                return flattenIterables( Iterables.map( function, TYPES_OF.apply( type ) ) );
             }
         };
     }
@@ -415,9 +415,9 @@ public final class Classes
         AnnotationType findAnnotationOfTypeOrAnyOfSuperTypes( Class<?> type, Class<AnnotationType> annotationClass )
     {
         AnnotationType result = null;
-        for( Type clazz : Classes.TYPES_OF.map( type ) )
+        for( Type clazz : Classes.TYPES_OF.apply( type ) )
         {
-            result = Classes.RAW_CLASS.map( clazz ).getAnnotation( annotationClass );
+            result = Classes.RAW_CLASS.apply( clazz ).getAnnotation( annotationClass );
             if( result != null )
             {
                 break;
@@ -427,12 +427,12 @@ public final class Classes
         return result;
     }
 
-    public static Specification<Member> memberNamed( final String name )
+    public static Predicate<Member> memberNamed( final String name )
     {
-        return new Specification<Member>()
+        return new Predicate<Member>()
         {
             @Override
-            public boolean satisfiedBy( Member item )
+            public boolean test( Member item )
             {
                 return item.getName().equals( name );
             }
@@ -480,7 +480,7 @@ public final class Classes
         List<Type> types = new ArrayList<>();
         for( Type type : current.getGenericInterfaces() )
         {
-            Iterable<Type> interfaces = Classes.INTERFACES_OF.map( type );
+            Iterable<Type> interfaces = Classes.INTERFACES_OF.apply( type );
             for( Type anInterface : interfaces )
             {
                 if( !types.contains( anInterface ) )
@@ -593,24 +593,24 @@ public final class Classes
         return uriPart.replace( '-', '$' );
     }
 
-    public static Specification<ModelDescriptor> modelTypeSpecification( final String className )
+    public static Predicate<ModelDescriptor> modelTypeSpecification( final String className )
     {
-        return new Specification<ModelDescriptor>()
+        return new Predicate<ModelDescriptor>()
         {
             @Override
-            public boolean satisfiedBy( ModelDescriptor item )
+            public boolean test( ModelDescriptor item )
             {
-                return matchesAny( new Specification<String>()
+                return matchesAny( new Predicate<String>()
                 {
                     @Override
-                    public boolean satisfiedBy( String item )
+                    public boolean test( String item )
                     {
                         return item.equals( className );
                     }
                 }, map( new Function<Class<?>, String>()
                 {
                     @Override
-                    public String map( Class<?> item )
+                    public String apply( Class<?> item )
                     {
                         return item.getName();
                     }
@@ -620,17 +620,17 @@ public final class Classes
     }
 
     @SuppressWarnings( "raw" )
-    public static Specification<ModelDescriptor> exactTypeSpecification( final Class type )
+    public static Predicate<ModelDescriptor> exactTypeSpecification( final Class type )
     {
-        return new Specification<ModelDescriptor>()
+        return new Predicate<ModelDescriptor>()
         {
             @Override
-            public boolean satisfiedBy( ModelDescriptor item )
+            public boolean test( ModelDescriptor item )
             {
-                return matchesAny( new Specification<Class<?>>()
+                return matchesAny( new Predicate<Class<?>>()
                 {
                     @Override
-                    public boolean satisfiedBy( Class<?> item )
+                    public boolean test( Class<?> item )
                     {
                         return item.equals( type );
                     }
@@ -640,18 +640,18 @@ public final class Classes
     }
 
     @SuppressWarnings( "raw" )
-    public static Specification<ModelDescriptor> assignableTypeSpecification( final Class type )
+    public static Predicate<ModelDescriptor> assignableTypeSpecification( final Class type )
     {
-        return new Specification<ModelDescriptor>()
+        return new Predicate<ModelDescriptor>()
         {
             @Override
-            public boolean satisfiedBy( ModelDescriptor item )
+            public boolean test( ModelDescriptor item )
             {
-                return matchesAny( new Specification<Class<?>>()
+                return matchesAny( new Predicate<Class<?>>()
                 {
                     @Override
                     @SuppressWarnings( "unchecked" )
-                    public boolean satisfiedBy( Class<?> itemType )
+                    public boolean test( Class<?> itemType )
                     {
                         return !type.equals( itemType ) && type.isAssignableFrom( itemType );
                     }
@@ -684,9 +684,9 @@ public final class Classes
         return new Function<Type, String>()
         {
             @Override
-            public String map( Type type )
+            public String apply( Type type )
             {
-                return RAW_CLASS.map( type ).getName();
+                return RAW_CLASS.apply( type ).getName();
             }
         };
     }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/util/Constructors.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/util/Constructors.java b/core/api/src/main/java/org/qi4j/api/util/Constructors.java
index c9a50d6..6e7f0ce 100644
--- a/core/api/src/main/java/org/qi4j/api/util/Constructors.java
+++ b/core/api/src/main/java/org/qi4j/api/util/Constructors.java
@@ -2,7 +2,7 @@ package org.qi4j.api.util;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Type;
-import org.qi4j.functional.Function;
+import java.util.function.Function;
 
 import static org.qi4j.functional.Iterables.iterable;
 
@@ -14,7 +14,7 @@ public final class Constructors
     public static final Function<Type, Iterable<Constructor<?>>> CONSTRUCTORS_OF = Classes.forClassHierarchy( new Function<Class<?>, Iterable<Constructor<?>>>()
     {
         @Override
-        public Iterable<Constructor<?>> map( Class<?> type )
+        public Iterable<Constructor<?>> apply( Class<?> type )
         {
             return iterable( type.getDeclaredConstructors() );
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/util/Fields.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/util/Fields.java b/core/api/src/main/java/org/qi4j/api/util/Fields.java
index ea8d6e2..c5c65e3 100644
--- a/core/api/src/main/java/org/qi4j/api/util/Fields.java
+++ b/core/api/src/main/java/org/qi4j/api/util/Fields.java
@@ -2,8 +2,8 @@ package org.qi4j.api.util;
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Type;
-import org.qi4j.functional.Function;
-import org.qi4j.functional.Function2;
+import java.util.function.BiFunction;
+import java.util.function.Function;
 import org.qi4j.functional.Iterables;
 
 import static org.qi4j.functional.Iterables.iterable;
@@ -13,19 +13,19 @@ import static org.qi4j.functional.Iterables.iterable;
  */
 public final class Fields
 {
-    public static final Function2<Class<?>, String, Field> FIELD_NAMED = new Function2<Class<?>, String, Field>()
+    public static final BiFunction<Class<?>, String, Field> FIELD_NAMED = new BiFunction<Class<?>, String, Field>()
     {
         @Override
-        public Field map( Class<?> aClass, String name )
+        public Field apply( Class<?> aClass, String name )
         {
-            return Iterables.first( Iterables.filter( Classes.memberNamed( name ), FIELDS_OF.map( aClass ) ) );
+            return Iterables.first( Iterables.filter( Classes.memberNamed( name ), FIELDS_OF.apply( aClass ) ) );
         }
     };
 
     public static final Function<Type, Iterable<Field>> FIELDS_OF = Classes.forClassHierarchy( new Function<Class<?>, Iterable<Field>>()
     {
         @Override
-        public Iterable<Field> map( Class<?> type )
+        public Iterable<Field> apply( Class<?> type )
         {
             return iterable( type.getDeclaredFields() );
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/util/Methods.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/util/Methods.java b/core/api/src/main/java/org/qi4j/api/util/Methods.java
index d59632f..fecb99c 100644
--- a/core/api/src/main/java/org/qi4j/api/util/Methods.java
+++ b/core/api/src/main/java/org/qi4j/api/util/Methods.java
@@ -2,8 +2,8 @@ package org.qi4j.api.util;
 
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
-import org.qi4j.functional.Function;
-import org.qi4j.functional.Specification;
+import java.util.function.Function;
+import java.util.function.Predicate;
 
 import static org.qi4j.functional.Iterables.iterable;
 
@@ -12,21 +12,21 @@ import static org.qi4j.functional.Iterables.iterable;
  */
 public class Methods
 {
-    public static final Specification<Type> HAS_METHODS = new Specification<Type>()
+    public static final Predicate<Type> HAS_METHODS = new Predicate<Type>()
     {
         @Override
-        public boolean satisfiedBy( Type item )
+        public boolean test( Type item )
         {
-            return Classes.RAW_CLASS.map( item ).getDeclaredMethods().length > 0;
+            return Classes.RAW_CLASS.apply( item ).getDeclaredMethods().length > 0;
         }
     };
 
     public static final Function<Type, Iterable<Method>> METHODS_OF = Classes.forTypes( new Function<Type, Iterable<Method>>()
     {
         @Override
-        public Iterable<Method> map( Type type )
+        public Iterable<Method> apply( Type type )
         {
-            return iterable( Classes.RAW_CLASS.map( type ).getDeclaredMethods() );
+            return iterable( Classes.RAW_CLASS.apply( type ).getDeclaredMethods() );
         }
     } );
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/value/ValueBuilderFactory.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/value/ValueBuilderFactory.java b/core/api/src/main/java/org/qi4j/api/value/ValueBuilderFactory.java
index 57c4e29..b1d0e10 100644
--- a/core/api/src/main/java/org/qi4j/api/value/ValueBuilderFactory.java
+++ b/core/api/src/main/java/org/qi4j/api/value/ValueBuilderFactory.java
@@ -14,11 +14,11 @@
 package org.qi4j.api.value;
 
 import java.util.Map;
+import java.util.function.Function;
 import org.qi4j.api.association.AssociationDescriptor;
 import org.qi4j.api.common.ConstructionException;
 import org.qi4j.api.entity.EntityReference;
 import org.qi4j.api.property.PropertyDescriptor;
-import org.qi4j.functional.Function;
 
 /**
  * Factory for Values and ValueBuilders.

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/value/ValueDeserializer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/value/ValueDeserializer.java b/core/api/src/main/java/org/qi4j/api/value/ValueDeserializer.java
index 175b176..48e1203 100644
--- a/core/api/src/main/java/org/qi4j/api/value/ValueDeserializer.java
+++ b/core/api/src/main/java/org/qi4j/api/value/ValueDeserializer.java
@@ -16,9 +16,9 @@
 package org.qi4j.api.value;
 
 import java.io.InputStream;
+import java.util.function.BiFunction;
+import java.util.function.Function;
 import org.qi4j.api.type.ValueType;
-import org.qi4j.functional.Function;
-import org.qi4j.functional.Function2;
 
 /**
  * Use a ValueDeserializer to create new values instances from serialized state.
@@ -100,7 +100,7 @@ public interface ValueDeserializer
      * @param <T> the parametrized function return type
      * @return a deserialization function
      */
-    <T> Function2<ValueType, String, T> deserialize();
+    <T> BiFunction<ValueType, String, T> deserialize();
 
     /**
      * Deserialize a value from a state.

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/main/java/org/qi4j/api/value/ValueSerializer.java
----------------------------------------------------------------------
diff --git a/core/api/src/main/java/org/qi4j/api/value/ValueSerializer.java b/core/api/src/main/java/org/qi4j/api/value/ValueSerializer.java
index 13a8831..06e8599 100644
--- a/core/api/src/main/java/org/qi4j/api/value/ValueSerializer.java
+++ b/core/api/src/main/java/org/qi4j/api/value/ValueSerializer.java
@@ -18,8 +18,8 @@ package org.qi4j.api.value;
 import java.io.OutputStream;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.function.Function;
 import org.qi4j.api.composite.AmbiguousTypeException;
-import org.qi4j.functional.Function;
 
 /**
  * Use a ValueSerializer to serialize values state.

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/test/java/org/qi4j/api/OperatorsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/qi4j/api/OperatorsTest.java b/core/api/src/test/java/org/qi4j/api/OperatorsTest.java
index 1ffaa92..a015ea7 100644
--- a/core/api/src/test/java/org/qi4j/api/OperatorsTest.java
+++ b/core/api/src/test/java/org/qi4j/api/OperatorsTest.java
@@ -1,5 +1,6 @@
 package org.qi4j.api;
 
+import java.util.function.Predicate;
 import org.junit.Assert;
 import org.junit.Test;
 import org.qi4j.api.activation.ActivationException;
@@ -16,7 +17,6 @@ import org.qi4j.bootstrap.AssemblyException;
 import org.qi4j.bootstrap.ModuleAssembly;
 import org.qi4j.bootstrap.SingletonAssembler;
 import org.qi4j.functional.Iterables;
-import org.qi4j.functional.Specification;
 import org.qi4j.test.EntityTestAssembler;
 
 /**
@@ -59,17 +59,17 @@ public class OperatorsTest
             QueryBuilder<TestEntity> builder = assembler.module().newQueryBuilder( TestEntity.class );
 
             {
-                Specification<Composite> where = QueryExpressions.eq( QueryExpressions.templateFor( TestEntity.class )
+                Predicate<Composite> where = QueryExpressions.eq( QueryExpressions.templateFor( TestEntity.class )
                                                                           .foo(), "Bar" );
-                Assert.assertTrue( where.satisfiedBy( testEntity ) );
+                Assert.assertTrue( where.test( testEntity ) );
                 System.out.println( where );
             }
             {
-                Specification<Composite> where = QueryExpressions.eq( QueryExpressions.templateFor( TestEntity.class )
+                Predicate<Composite> where = QueryExpressions.eq( QueryExpressions.templateFor( TestEntity.class )
                                                                           .value()
                                                                           .get()
                                                                           .bar(), "Xyz" );
-                Assert.assertTrue( where.satisfiedBy( testEntity ) );
+                Assert.assertTrue( where.test( testEntity ) );
                 System.out.println( where );
 
                 Assert.assertTrue( builder.where( where ).newQuery( entities ).find().equals( testEntity ) );

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/test/java/org/qi4j/api/common/QualifiedNameTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/qi4j/api/common/QualifiedNameTest.java b/core/api/src/test/java/org/qi4j/api/common/QualifiedNameTest.java
index c9c0583..5c110d0 100644
--- a/core/api/src/test/java/org/qi4j/api/common/QualifiedNameTest.java
+++ b/core/api/src/test/java/org/qi4j/api/common/QualifiedNameTest.java
@@ -11,14 +11,14 @@ public class QualifiedNameTest
     public void testQualifiedNameWithDollar()
     {
         assertEquals( "Name containing dollar is modified", "Test-Test",
-                      new QualifiedName( TypeName.nameOf( "Test$Test" ), "satisfiedBy" ).type() );
+                      new QualifiedName( TypeName.nameOf( "Test$Test" ), "test" ).type() );
     }
 
     @Test
     public void testQualifiedNameFromQNWithDollar()
     {
         assertEquals( "Name containing dollar is cleaned up", "Test-Test",
-                      QualifiedName.fromFQN( "Test$Test:satisfiedBy" ).type() );
+                      QualifiedName.fromFQN( "Test$Test:test" ).type() );
     }
 
     @Test( expected = NullArgumentException.class )
@@ -30,7 +30,7 @@ public class QualifiedNameTest
     @Test( expected = NullArgumentException.class )
     public void nonNullArguments2()
     {
-        new QualifiedName( null, "satisfiedBy" );
+        new QualifiedName( null, "test" );
     }
 
     @Test( expected = NullArgumentException.class )
@@ -54,7 +54,7 @@ public class QualifiedNameTest
     @Test( expected = NullArgumentException.class )
     public void nonNullArguments6()
     {
-        QualifiedName.fromClass( null, "satisfiedBy" );
+        QualifiedName.fromClass( null, "test" );
     }
 
     @Test( expected = NullArgumentException.class )

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/test/java/org/qi4j/api/specification/IntegerRangeSpecificationTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/qi4j/api/specification/IntegerRangeSpecificationTest.java b/core/api/src/test/java/org/qi4j/api/specification/IntegerRangeSpecificationTest.java
new file mode 100644
index 0000000..52ee670
--- /dev/null
+++ b/core/api/src/test/java/org/qi4j/api/specification/IntegerRangeSpecificationTest.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2012, Niclas Hedhman. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ *
+ *     You may obtain a copy of the License at
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.qi4j.api.specification;
+
+import java.util.function.Predicate;
+import org.junit.Test;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+// This test exist primarily for the documentation. Don't remove.
+public class IntegerRangeSpecificationTest
+{
+    @Test
+    public void test1()
+    {
+        Predicate<Integer> spec = new IntegerRangeSpecification( 10, 12 );
+        assertTrue( spec.test( 10 ) );
+        assertTrue( spec.test( 11 ) );
+        assertTrue( spec.test( 12 ) );
+        assertFalse( spec.test( 9 ) );
+        assertFalse( spec.test( 13 ) );
+    }
+
+    // START SNIPPET: specification
+    public static class IntegerRangeSpecification
+        implements Predicate<Integer>
+    {
+
+        private int lower;
+        private int higher;
+
+        public IntegerRangeSpecification( int lower, int higher )
+        {
+            this.lower = lower;
+            this.higher = higher;
+        }
+
+        @Override
+        public boolean test( Integer item )
+        {
+            return item >= lower && item <= higher;
+        }
+    }
+    // END SNIPPET: specification
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/test/java/org/qi4j/api/specification/SpecificationsTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/qi4j/api/specification/SpecificationsTest.java b/core/api/src/test/java/org/qi4j/api/specification/SpecificationsTest.java
new file mode 100644
index 0000000..ca295bf
--- /dev/null
+++ b/core/api/src/test/java/org/qi4j/api/specification/SpecificationsTest.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2010, Rickard Öberg. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.qi4j.api.specification;
+
+import java.util.function.Function;
+import java.util.function.Predicate;
+import org.junit.Assert;
+import org.junit.Test;
+import org.qi4j.functional.Specifications;
+
+import static org.hamcrest.CoreMatchers.equalTo;
+
+/**
+ * JAVADOC
+ */
+public class SpecificationsTest
+{
+    @Test
+    public void testTRUE()
+    {
+        Assert.assertThat( Specifications.<Object>TRUE().test( new Object() ), equalTo( true ) );
+    }
+
+    @Test
+    public void testNot()
+    {
+        Assert.assertThat( Specifications.not( Specifications.<Object>TRUE() )
+                               .test( new Object() ), equalTo( false ) );
+    }
+
+    @Test
+    public void testAnd()
+    {
+        Predicate<Object> trueSpec = Specifications.<Object>TRUE();
+        Predicate<Object> falseSpec = Specifications.not( Specifications.<Object>TRUE() );
+
+        Assert.assertThat( Specifications.and( falseSpec, falseSpec ).test( new Object() ), equalTo( false ) );
+        Assert.assertThat( Specifications.and( trueSpec, falseSpec ).test( new Object() ), equalTo( false ) );
+        Assert.assertThat( Specifications.and( falseSpec, trueSpec ).test( new Object() ), equalTo( false ) );
+        Assert.assertThat( Specifications.and( trueSpec, trueSpec ).test( new Object() ), equalTo( true ) );
+    }
+
+    @Test
+    public void testOr()
+    {
+        Predicate<Object> trueSpec = Specifications.<Object>TRUE();
+        Predicate<Object> falseSpec = Specifications.not( Specifications.<Object>TRUE() );
+
+        Assert.assertThat( Specifications.or( falseSpec, falseSpec ).test( new Object() ), equalTo( false ) );
+        Assert.assertThat( Specifications.or( trueSpec, falseSpec ).test( new Object() ), equalTo( true ) );
+        Assert.assertThat( Specifications.or( falseSpec, trueSpec ).test( new Object() ), equalTo( true ) );
+        Assert.assertThat( Specifications.or( trueSpec, trueSpec ).test( new Object() ), equalTo( true ) );
+    }
+
+    @Test
+    public void testIn()
+    {
+        Assert.assertThat( Specifications.in( "1", "2", "3" ).test( "2" ), equalTo( true ) );
+        Assert.assertThat( Specifications.in( "1", "2", "3" ).test( "4" ), equalTo( false ) );
+    }
+
+    @Test
+    public void testTranslate()
+    {
+        Function<Object, String> stringifier = new Function<Object, String>()
+        {
+            @Override
+            public String apply( Object s )
+            {
+                return s.toString();
+            }
+        };
+
+        Assert.assertTrue( Specifications.translate( stringifier, Specifications.in( "3" ) ).test( 3L ) );
+    }
+}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/test/java/org/qi4j/api/util/ClassesTest.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/qi4j/api/util/ClassesTest.java b/core/api/src/test/java/org/qi4j/api/util/ClassesTest.java
index 85be327..3478f2d 100644
--- a/core/api/src/test/java/org/qi4j/api/util/ClassesTest.java
+++ b/core/api/src/test/java/org/qi4j/api/util/ClassesTest.java
@@ -20,9 +20,9 @@ import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.function.Predicate;
 import org.junit.Test;
 import org.qi4j.functional.Iterables;
-import org.qi4j.functional.Specification;
 import org.qi4j.functional.Specifications;
 
 import static org.hamcrest.CoreMatchers.equalTo;
@@ -61,7 +61,7 @@ public class ClassesTest
     {
         Iterable<Type> types = Iterables.filter( Methods.HAS_METHODS, interfacesOf( C.class ) );
         assertThat( "one interface returned", count( types ), equalTo( 1L ) );
-        assertThat( "correct interface returned", Iterables.matchesAny( (Specification) Specifications.in( B.class ), Iterables
+        assertThat( "correct interface returned", Iterables.matchesAny( (Predicate) Specifications.in( B.class ), Iterables
             .<Class<?>>cast( types ) ), is( true ) );
     }
 
@@ -83,7 +83,7 @@ public class ClassesTest
     {
         Type returnType = Generics.class.getMethod( "wildcard" ).getGenericReturnType();
         Type wildcardType = ( (ParameterizedType) returnType ).getActualTypeArguments()[ 0];
-        assertThat( "Return type is A", Classes.RAW_CLASS.map( wildcardType ), equalTo( (Class) A.class ) );
+        assertThat( "Return type is A", Classes.RAW_CLASS.apply( wildcardType ), equalTo( (Class) A.class ) );
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/api/src/test/java/org/qi4j/api/value/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/api/src/test/java/org/qi4j/api/value/DocumentationSupport.java b/core/api/src/test/java/org/qi4j/api/value/DocumentationSupport.java
index 32595b2..14b7b05 100644
--- a/core/api/src/test/java/org/qi4j/api/value/DocumentationSupport.java
+++ b/core/api/src/test/java/org/qi4j/api/value/DocumentationSupport.java
@@ -27,6 +27,7 @@ import java.io.Writer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.function.Function;
 import org.junit.Before;
 import org.junit.Test;
 import org.qi4j.api.injection.scope.Service;
@@ -41,7 +42,6 @@ import org.qi4j.bootstrap.Assembler;
 import org.qi4j.bootstrap.AssemblyException;
 import org.qi4j.bootstrap.Energy4Java;
 import org.qi4j.bootstrap.ModuleAssembly;
-import org.qi4j.functional.Function;
 import org.qi4j.io.Inputs;
 import org.qi4j.io.Outputs;
 import org.qi4j.io.Transforms;
@@ -252,7 +252,7 @@ public class DocumentationSupport
                                     Function<Application, Module> valuesModuleFinder = new Function<Application, Module>()
                                     {
                                         @Override
-                                        public Module map( Application app )
+                                        public Module apply( Application app )
                                         {
                                             return app.findModule( "SINGLE-Layer", "VALUES-Module" );
                                         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/bootstrap/src/main/java/org/qi4j/bootstrap/ApplicationAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/qi4j/bootstrap/ApplicationAssembly.java b/core/bootstrap/src/main/java/org/qi4j/bootstrap/ApplicationAssembly.java
index b14d554..ca5be95 100644
--- a/core/bootstrap/src/main/java/org/qi4j/bootstrap/ApplicationAssembly.java
+++ b/core/bootstrap/src/main/java/org/qi4j/bootstrap/ApplicationAssembly.java
@@ -82,7 +82,7 @@ public interface ApplicationAssembly
 
     /**
      * Set the application mode. This will be set to "production" by default. You can
-     * set the system property "mode" to either "development", "satisfiedBy" or "production"
+     * set the system property "mode" to either "test", "development", "staging" or "production"
      * to explicitly set the mode. If that is not an option, then call this method
      * during assembly to set the mode. The mode may then be queried by assemblers,
      * and they may assemble the application differentlly depending on this setting.

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/bootstrap/src/main/java/org/qi4j/bootstrap/AssemblySpecifications.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/qi4j/bootstrap/AssemblySpecifications.java b/core/bootstrap/src/main/java/org/qi4j/bootstrap/AssemblySpecifications.java
index a8294d8..cd44933 100644
--- a/core/bootstrap/src/main/java/org/qi4j/bootstrap/AssemblySpecifications.java
+++ b/core/bootstrap/src/main/java/org/qi4j/bootstrap/AssemblySpecifications.java
@@ -1,7 +1,7 @@
 package org.qi4j.bootstrap;
 
+import java.util.function.Predicate;
 import org.qi4j.api.type.HasTypes;
-import org.qi4j.functional.Specification;
 import org.qi4j.functional.Specifications;
 
 /**
@@ -9,17 +9,17 @@ import org.qi4j.functional.Specifications;
  */
 public class AssemblySpecifications
 {
-    public static Specification<HasTypes> types( final Class... types )
+    public static Predicate<HasTypes> types( final Class... types )
     {
-        return new Specification<HasTypes>()
+        return new Predicate<HasTypes>()
         {
             @Override
-            public boolean satisfiedBy( HasTypes item )
+            public boolean test( HasTypes item )
             {
 
                 for( Class<?> type : item.types() )
                 {
-                    if( Specifications.in( types ).satisfiedBy( type ) )
+                    if( Specifications.in( types ).test( type ) )
                     {
                         return true;
                     }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/bootstrap/src/main/java/org/qi4j/bootstrap/ClassScanner.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/qi4j/bootstrap/ClassScanner.java b/core/bootstrap/src/main/java/org/qi4j/bootstrap/ClassScanner.java
index 70c2946..2895f20 100644
--- a/core/bootstrap/src/main/java/org/qi4j/bootstrap/ClassScanner.java
+++ b/core/bootstrap/src/main/java/org/qi4j/bootstrap/ClassScanner.java
@@ -23,12 +23,12 @@ import java.lang.reflect.Modifier;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.security.CodeSource;
+import java.util.function.Function;
+import java.util.function.Predicate;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.regex.Pattern;
-import org.qi4j.functional.Function;
 import org.qi4j.functional.Iterables;
-import org.qi4j.functional.Specification;
 
 import static org.qi4j.functional.Iterables.filter;
 import static org.qi4j.functional.Iterables.flatten;
@@ -90,7 +90,7 @@ public class ClassScanner
                                                      map( new Function<JarEntry, Class<?>>()
                                                      {
                                                          @Override
-                                                         public Class map( JarEntry jarEntry )
+                                                         public Class apply( JarEntry jarEntry )
                                                          {
                                                              String name = jarEntry.getName();
                                                              name = name.substring( 0, name.length() - 6 );
@@ -105,10 +105,10 @@ public class ClassScanner
                                                              }
                                                          }
                                                      }
-                                                         , filter( new Specification<JarEntry>()
+                                                         , filter( new Predicate<JarEntry>()
                                                      {
                                                          @Override
-                                                         public boolean satisfiedBy( JarEntry jarEntry )
+                                                         public boolean test( JarEntry jarEntry )
                                                          {
                                                              return jarEntry.getName()
                                                                         .startsWith( packageName ) && jarEntry.getName()
@@ -129,10 +129,10 @@ public class ClassScanner
         else
         {
             final File path = new File( file, seedClass.getPackage().getName().replace( '.', File.separatorChar ) );
-            Iterable<File> files = findFiles( path, new Specification<File>()
+            Iterable<File> files = findFiles( path, new Predicate<File>()
             {
                 @Override
-                public boolean satisfiedBy( File file )
+                public boolean test( File file )
                 {
                     return file.getName().endsWith( ".class" );
                 }
@@ -142,7 +142,7 @@ public class ClassScanner
                            map( new Function<File, Class<?>>()
                            {
                                @Override
-                               public Class<?> map( File f )
+                               public Class<?> apply( File f )
                                {
                                    String fileName = f.getAbsolutePath().substring( file.toString().length() + 1 );
                                    fileName = fileName.replace( File.separatorChar, '.' )
@@ -170,34 +170,34 @@ public class ClassScanner
      *
      * @return regex class name specification
      */
-    public static Specification<Class<?>> matches( String regex )
+    public static Predicate<Class<?>> matches( String regex )
     {
         final Pattern pattern = Pattern.compile( regex );
 
-        return new Specification<Class<?>>()
+        return new Predicate<Class<?>>()
         {
             @Override
-            public boolean satisfiedBy( Class<?> aClass )
+            public boolean test( Class<?> aClass )
             {
                 return pattern.matcher( aClass.getName() ).matches();
             }
         };
     }
 
-    private static Iterable<File> findFiles( File directory, final Specification<File> filter )
+    private static Iterable<File> findFiles( File directory, final Predicate<File> filter )
     {
         return flatten( filter( filter, iterable( directory.listFiles() ) ),
                         flattenIterables( map( new Function<File, Iterable<File>>()
                         {
                             @Override
-                            public Iterable<File> map( File file )
+                            public Iterable<File> apply( File file )
                             {
                                 return findFiles( file, filter );
                             }
-                        }, filter( new Specification<File>()
+                        }, filter( new Predicate<File>()
                         {
                             @Override
-                            public boolean satisfiedBy( File file )
+                            public boolean test( File file )
                             {
                                 return file.isDirectory();
                             }
@@ -205,10 +205,10 @@ public class ClassScanner
     }
 
     private static class ValidClass
-        implements Specification<Class<?>>
+        implements Predicate<Class<?>>
     {
         @Override
-        public boolean satisfiedBy( Class<?> item )
+        public boolean test( Class<?> item )
         {
             return ( item.isInterface() || !Modifier.isAbstract( item.getModifiers() ) ) && ( !item.isEnum() && !item.isAnonymousClass() );
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/bootstrap/src/main/java/org/qi4j/bootstrap/LayerAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/qi4j/bootstrap/LayerAssembly.java b/core/bootstrap/src/main/java/org/qi4j/bootstrap/LayerAssembly.java
index 5880b3e..7b52467 100644
--- a/core/bootstrap/src/main/java/org/qi4j/bootstrap/LayerAssembly.java
+++ b/core/bootstrap/src/main/java/org/qi4j/bootstrap/LayerAssembly.java
@@ -19,9 +19,9 @@
 
 package org.qi4j.bootstrap;
 
+import java.util.function.Predicate;
 import org.qi4j.api.activation.Activator;
 import org.qi4j.api.structure.Layer;
-import org.qi4j.functional.Specification;
 
 /**
  * Fluid API for declaring a layer in an application. This is obtained by calling {@link ApplicationAssembly#layer(String)}.
@@ -69,7 +69,7 @@ public interface LayerAssembly
      *
      * @return An EntityDeclaration for the specified EntityComposite types.
      */
-    EntityDeclaration entities( Specification<? super EntityAssembly> specification );
+    EntityDeclaration entities( Predicate<? super EntityAssembly> specification );
 
     /**
      * Given a Specification for ServiceAssembly's, returns a ServiceDeclaration that can
@@ -79,7 +79,7 @@ public interface LayerAssembly
      *
      * @return An ServiceDeclaration for the specified ServiceComposite types.
      */
-    ServiceDeclaration services( Specification<? super ServiceAssembly> specification );
+    ServiceDeclaration services( Predicate<? super ServiceAssembly> specification );
 
     /**
      * Given a Specification for TransientAssembly's, returns a TransientDeclaration that can
@@ -89,7 +89,7 @@ public interface LayerAssembly
      *
      * @return An TransientDeclaration for the specified TransientComposite types.
      */
-    TransientDeclaration transients( Specification<? super TransientAssembly> specification );
+    TransientDeclaration transients( Predicate<? super TransientAssembly> specification );
 
     /**
      * Given a Specification for ValueAssembly's, returns a ValueDeclaration that can
@@ -99,7 +99,7 @@ public interface LayerAssembly
      *
      * @return An ValueDeclaration for the specified ValueComposite types.
      */
-    ValueDeclaration values( Specification<? super ValueAssembly> specification );
+    ValueDeclaration values( Predicate<? super ValueAssembly> specification );
 
     /**
      * Given a Specification for ObjectAssembly's, returns a ObjectDeclaration that can
@@ -109,7 +109,7 @@ public interface LayerAssembly
      *
      * @return An ObjectDeclaration for the specified Object types.
      */
-    ObjectDeclaration objects( Specification<? super ObjectAssembly> specification );
+    ObjectDeclaration objects( Predicate<? super ObjectAssembly> specification );
 
     /**
      * Given a Specification for ImportedServiceAssembly's, returns a ImportedServiceDeclaration that can
@@ -119,5 +119,5 @@ public interface LayerAssembly
      *
      * @return An ImportedServiceDeclaration for the specified Imported Service types.
      */
-    ImportedServiceDeclaration importedServices( Specification<? super ImportedServiceAssembly> specification );
+    ImportedServiceDeclaration importedServices( Predicate<? super ImportedServiceAssembly> specification );
 }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/bootstrap/src/main/java/org/qi4j/bootstrap/ModuleAssembly.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/main/java/org/qi4j/bootstrap/ModuleAssembly.java b/core/bootstrap/src/main/java/org/qi4j/bootstrap/ModuleAssembly.java
index 805b232..39cce32 100644
--- a/core/bootstrap/src/main/java/org/qi4j/bootstrap/ModuleAssembly.java
+++ b/core/bootstrap/src/main/java/org/qi4j/bootstrap/ModuleAssembly.java
@@ -19,9 +19,9 @@
 
 package org.qi4j.bootstrap;
 
+import java.util.function.Predicate;
 import org.qi4j.api.activation.Activator;
 import org.qi4j.api.structure.Module;
-import org.qi4j.functional.Specification;
 
 /**
  * The ModuleAssembly is used to register any information about * what the module should contain, such as composites,
@@ -95,7 +95,7 @@ public interface ModuleAssembly
      *
      * @return An TransientDeclaration for the specified TransientComposite types.
      */
-    TransientDeclaration transients( Specification<? super TransientAssembly> specification );
+    TransientDeclaration transients( Predicate<? super TransientAssembly> specification );
 
     /**
      * Declare a list of ValueComposites for this Module. Use the ValueDeclaration that is returned to
@@ -115,7 +115,7 @@ public interface ModuleAssembly
      *
      * @return An ValueDeclaration for the specified ValueComposite types.
      */
-    ValueDeclaration values( Specification<? super ValueAssembly> specification );
+    ValueDeclaration values( Predicate<? super ValueAssembly> specification );
 
     /**
      * Declare a list of EntityComposites for this Module. Use the EntityDeclaration that is returned to
@@ -135,7 +135,7 @@ public interface ModuleAssembly
      *
      * @return An EntityDeclaration for the specified EntityComposite types.
      */
-    EntityDeclaration entities( Specification<? super EntityAssembly> specification );
+    EntityDeclaration entities( Predicate<? super EntityAssembly> specification );
 
     /**
      * Declare a list of object classes for this Module. Use the ObjectDeclaration that is returned to
@@ -156,7 +156,7 @@ public interface ModuleAssembly
      *
      * @return An ObjectDeclaration for the specified Object types.
      */
-    ObjectDeclaration objects( Specification<? super ObjectAssembly> specification );
+    ObjectDeclaration objects( Predicate<? super ObjectAssembly> specification );
 
     /**
      * Create a list of ServiceComposites for this Module. Use the ServiceDeclaration that is returned to
@@ -187,7 +187,7 @@ public interface ModuleAssembly
      *
      * @return An ServiceDeclaration for the specified ServiceComposite types.
      */
-    ServiceDeclaration services( Specification<? super ServiceAssembly> specification );
+    ServiceDeclaration services( Predicate<? super ServiceAssembly> specification );
 
     /**
      * Declare a list of imported services for this Module. Use the ImportedServiceDeclaration that is returned to
@@ -207,7 +207,7 @@ public interface ModuleAssembly
      *
      * @return An ImportedServiceDeclaration for the specified Imported Service types.
      */
-    ImportedServiceDeclaration importedServices( Specification<? super ImportedServiceAssembly> specification );
+    ImportedServiceDeclaration importedServices( Predicate<? super ImportedServiceAssembly> specification );
 
     <T> MixinDeclaration<T> forMixin( Class<T> mixinType );
 

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java
----------------------------------------------------------------------
diff --git a/core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java b/core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java
index 547cf87..4ec7f6a 100644
--- a/core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java
+++ b/core/bootstrap/src/test/java/org/qi4j/bootstrap/DocumentationSupport.java
@@ -1,5 +1,6 @@
 package org.qi4j.bootstrap;
 
+import java.util.function.Predicate;
 import org.qi4j.api.activation.ActivationException;
 import org.qi4j.api.common.Visibility;
 import org.qi4j.api.property.Property;
@@ -9,15 +10,14 @@ import org.qi4j.api.structure.Application;
 import org.qi4j.api.structure.ApplicationDescriptor;
 import org.qi4j.api.structure.Module;
 import org.qi4j.functional.Iterables;
-import org.qi4j.functional.Specification;
 
 public class DocumentationSupport
 {
 
-    public static Specification<ObjectAssembly> hasMyTypeSpecification = new Specification<ObjectAssembly>()
+    public static Predicate<ObjectAssembly> hasMyTypeSpecification = new Predicate<ObjectAssembly>()
     {
 
-        public boolean satisfiedBy( ObjectAssembly item )
+        public boolean test( ObjectAssembly item )
         {
             return Iterables.toList( item.types() ).contains( String.class );
         }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/functional/src/main/java/org/qi4j/functional/ForEach.java
----------------------------------------------------------------------
diff --git a/core/functional/src/main/java/org/qi4j/functional/ForEach.java b/core/functional/src/main/java/org/qi4j/functional/ForEach.java
index c2bbe3e..a87dcb9 100644
--- a/core/functional/src/main/java/org/qi4j/functional/ForEach.java
+++ b/core/functional/src/main/java/org/qi4j/functional/ForEach.java
@@ -14,6 +14,8 @@
 package org.qi4j.functional;
 
 import java.util.Iterator;
+import java.util.function.Function;
+import java.util.function.Predicate;
 
 /**
  * When using Iterables with map() and filter() the code often reads "in reverse", with the first item last in the code.
@@ -46,7 +48,7 @@ public final class ForEach<T>
         return iterable.iterator();
     }
 
-    public ForEach<T> filter( Specification<? super T> specification )
+    public ForEach<T> filter( Predicate<? super T> specification )
     {
         return new ForEach<>( Iterables.filter( specification, iterable ) );
     }

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/functional/src/main/java/org/qi4j/functional/Function.java
----------------------------------------------------------------------
diff --git a/core/functional/src/main/java/org/qi4j/functional/Function.java b/core/functional/src/main/java/org/qi4j/functional/Function.java
deleted file mode 100644
index 3edd3f1..0000000
--- a/core/functional/src/main/java/org/qi4j/functional/Function.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010, Rickard Öberg. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.qi4j.functional;
-
-/**
- * Generic function interface to map from one type to another.
- *
- * This can be used with the Iterables methods to transform lists of objects.
- *
- * @param <From>
- * @param <To>
- */
-public interface Function<From, To>
-{
-    /**
-     * Map a single item from one type to another
-     *
-     * @param from the input item
-     *
-     * @return the mapped item
-     */
-    To map( From from );
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/functional/src/main/java/org/qi4j/functional/Function2.java
----------------------------------------------------------------------
diff --git a/core/functional/src/main/java/org/qi4j/functional/Function2.java b/core/functional/src/main/java/org/qi4j/functional/Function2.java
deleted file mode 100644
index 7803965..0000000
--- a/core/functional/src/main/java/org/qi4j/functional/Function2.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2010, Rickard Öberg. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.qi4j.functional;
-
-/**
- * Generic function interface to map from two parameters to a third.
- *
- * This can be used with the Iterables methods to transform lists of objects.
- */
-public interface Function2<First, Second, To>
-{
-    /**
-     * Map a single item from one type to another
-     *
-     * @param first
-     * @param second
-     *
-     * @return the mapped item
-     */
-    To map( First first, Second second );
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/functional/src/main/java/org/qi4j/functional/Functions.java
----------------------------------------------------------------------
diff --git a/core/functional/src/main/java/org/qi4j/functional/Functions.java b/core/functional/src/main/java/org/qi4j/functional/Functions.java
deleted file mode 100644
index 0b50b35..0000000
--- a/core/functional/src/main/java/org/qi4j/functional/Functions.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * Copyright (c) 2010, Rickard Öberg. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.qi4j.functional;
-
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Utility functions. Combine these with methods in Iterables, for example. See FunctionsTest for usages.
- */
-public final class Functions
-{
-    public static <A, B, C> Function2<Function<? super B, C>, Function<A, B>, Function<A, C>> compose()
-    {
-        return new Function2<Function<? super B, C>, Function<A, B>, Function<A, C>>()
-        {
-            @Override
-            public Function<A, C> map( Function<? super B, C> bcFunction, Function<A, B> abFunction )
-            {
-                return compose( bcFunction, abFunction );
-            }
-        };
-    }
-
-    /**
-     * compose(F1(M,T),F2(F,M)) = F1(F2(F)) -&gt; T
-     *
-     * @param outer
-     * @param inner
-     *
-     * @return
-     */
-    public static <FROM, MIDDLE, TO> Function<FROM, TO> compose( final Function<? super MIDDLE, TO> outer,
-                                                                 final Function<FROM, MIDDLE> inner
-    )
-    {
-        return new Function<FROM, TO>()
-        {
-            @Override
-            public TO map( FROM from )
-            {
-                return outer.map( inner.map( from ) );
-            }
-        };
-    }
-
-    public static <TO, FROM extends TO> Function<FROM, TO> identity()
-    {
-        return new Function<FROM, TO>()
-        {
-            @Override
-            public TO map( FROM from )
-            {
-                return from;
-            }
-        };
-    }
-
-    public static <FROM, TO> Function<FROM, TO> fromMap( final Map<FROM, TO> map )
-    {
-        return new Function<FROM, TO>()
-        {
-            @Override
-            public TO map( FROM from )
-            {
-                return map.get( from );
-            }
-        };
-    }
-
-    public static <T> Function<T, T> withDefault( final T defaultValue )
-    {
-        return new Function<T, T>()
-        {
-            @Override
-            public T map( T from )
-            {
-                if( from == null )
-                {
-                    return defaultValue;
-                }
-                else
-                {
-                    return from;
-                }
-            }
-        };
-    }
-
-    public static Function<Number, Long> longSum()
-    {
-        return new Function<Number, Long>()
-        {
-            long sum;
-
-            @Override
-            public Long map( Number number )
-            {
-                sum += number.longValue();
-                return sum;
-            }
-        };
-    }
-
-    public static Function<Number, Integer> intSum()
-    {
-        return new Function<Number, Integer>()
-        {
-            int sum;
-
-            @Override
-            public Integer map( Number number )
-            {
-                sum += number.intValue();
-                return sum;
-            }
-        };
-    }
-
-    /**
-     * Count the number of items in an iterable that matches a given specification.
-     *
-     * Sample usage: last( map( count( in( "X" ) ), iterable( "X","Y","X","X","Y" ) ) )
-     * Returns: 3
-     *
-     * @param specification
-     * @param <T>
-     *
-     * @return
-     */
-    public static <T> Function<T, Integer> count( final Specification<T> specification )
-    {
-        return new Function<T, Integer>()
-        {
-            int count;
-
-            @Override
-            public Integer map( T item )
-            {
-                if( specification.satisfiedBy( item ) )
-                {
-                    count++;
-                }
-
-                return count;
-            }
-        };
-    }
-
-    /**
-     * Find out the index of an item matching a given specification in an iterable.
-     * Returns -1 if it is not found.
-     *
-     * @param specification
-     * @param <T>
-     *
-     * @return
-     */
-    public static <T> Function<T, Integer> indexOf( final Specification<T> specification )
-    {
-        return new Function<T, Integer>()
-        {
-            int index = -1;
-            int current = 0;
-
-            @Override
-            public Integer map( T item )
-            {
-                if( index == -1 && specification.satisfiedBy( item ) )
-                {
-                    index = current;
-                }
-
-                current++;
-
-                return index;
-            }
-        };
-    }
-
-    /**
-     * Find out the index of an item in an iterable.
-     *
-     * @param item
-     * @param iterable
-     * @param <T>
-     *
-     * @return
-     */
-    @SuppressWarnings( "unchecked" )
-    public static <T> int indexOf( T item, Iterable<T> iterable )
-    {
-        return Iterables.first( Iterables.filter( Specifications.not( Specifications.in( -1 ) ),
-                                                  Iterables.map( indexOf( Specifications.in( item ) ), iterable ) ) );
-    }
-
-    /**
-     * Only apply given function on objects that satisfies the given specification.
-     *
-     * @param specification
-     * @param function
-     * @param <T>
-     *
-     * @return
-     */
-    public static <T> Function<T, T> filteredMap( final Specification<T> specification, final Function<T, T> function )
-    {
-        return new Function<T, T>()
-        {
-            @Override
-            public T map( T from )
-            {
-                return specification.satisfiedBy( from ) ? function.map( from ) : from;
-            }
-        };
-    }
-
-    /**
-     * Creates a comparator that takes a function as input. The returned comparator will use the
-     * function once for each item in the list to be sorted by Collections.sort.
-     *
-     * This should be used if the function to generate the sort key from an object is expensive, so
-     * that it is not done many times for each item in a list.
-     *
-     * @param comparableFunction
-     * @param <T>
-     *
-     * @return
-     */
-    @SuppressWarnings( "raw" )
-    public static <T> Comparator<T> comparator( final Function<T, Comparable> comparableFunction )
-    {
-        return new Comparator<T>()
-        {
-            Map<T, Comparable> compareKeys = new HashMap<>();
-
-            @Override
-            @SuppressWarnings( "unchecked" )
-            public int compare( T o1, T o2 )
-            {
-                Comparable key1 = compareKeys.get( o1 );
-                if( key1 == null )
-                {
-                    key1 = comparableFunction.map( o1 );
-                    compareKeys.put( o1, key1 );
-                }
-
-                Comparable key2 = compareKeys.get( o2 );
-                if( key2 == null )
-                {
-                    key2 = comparableFunction.map( o2 );
-                    compareKeys.put( o2, key2 );
-                }
-
-                return key1.compareTo( key2 );
-            }
-        };
-    }
-
-    private Functions()
-    {
-    }
-}

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/functional/src/main/java/org/qi4j/functional/Iterables.java
----------------------------------------------------------------------
diff --git a/core/functional/src/main/java/org/qi4j/functional/Iterables.java b/core/functional/src/main/java/org/qi4j/functional/Iterables.java
index a3daf56..bdedbbd 100644
--- a/core/functional/src/main/java/org/qi4j/functional/Iterables.java
+++ b/core/functional/src/main/java/org/qi4j/functional/Iterables.java
@@ -26,6 +26,8 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
 import java.util.Set;
+import java.util.function.Function;
+import java.util.function.Predicate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -72,36 +74,6 @@ public final class Iterables
         return EMPTY;
     }
 
-    public static <T> Iterable<T> constant( final T item )
-    {
-        return new Iterable<T>()
-        {
-            @Override
-            public Iterator<T> iterator()
-            {
-                return new Iterator<T>()
-                {
-                    @Override
-                    public boolean hasNext()
-                    {
-                        return true;
-                    }
-
-                    @Override
-                    public T next()
-                    {
-                        return item;
-                    }
-
-                    @Override
-                    public void remove()
-                    {
-                    }
-                };
-            }
-        };
-    }
-
     public static <T> Iterable<T> limit( final int limitItems, final Iterable<T> iterable )
     {
         return new Iterable<T>()
@@ -207,9 +179,9 @@ public final class Iterables
     }
 
     @SuppressWarnings( "unchecked" )
-    public static <X> Iterable<X> filter( Specification<? /* super X*/> specification, Iterable<X> i )
+    public static <X> Iterable<X> filter( Predicate<? /* super X*/> specification, Iterable<X> i )
     {
-        return new FilterIterable<>( i, (Specification<? super X>) specification );
+        return new FilterIterable<>( i, (Predicate<? super X>) specification );
     }
 
     public static <X> X first( Iterable<X> i )
@@ -290,13 +262,13 @@ public final class Iterables
         return list;
     }
 
-    public static <T> boolean matchesAny( Specification<? super T> specification, Iterable<T> iterable )
+    public static <T> boolean matchesAny( Predicate<? super T> specification, Iterable<T> iterable )
     {
         boolean result = false;
 
         for( T item : iterable )
         {
-            if( ( (Specification<? super T>) specification ).satisfiedBy( item ) )
+            if( specification.test( item ) )
             {
                 result = true;
                 break;
@@ -306,12 +278,12 @@ public final class Iterables
         return result;
     }
 
-    public static <T> boolean matchesAll( Specification<? super T> specification, Iterable<T> iterable )
+    public static <T> boolean matchesAll( Predicate<? super T> specification, Iterable<T> iterable )
     {
         boolean result = true;
         for( T item : iterable )
         {
-            if( !specification.satisfiedBy( item ) )
+            if( !specification.test( item ) )
             {
                 result = false;
             }
@@ -342,7 +314,7 @@ public final class Iterables
                 final Iterable<Iterator<T>> iterators = toList( map( new Function<Iterable<T>, Iterator<T>>()
                 {
                     @Override
-                    public Iterator<T> map( Iterable<T> iterable )
+                    public Iterator<T> apply( Iterable<T> iterable )
                     {
                         return iterable.iterator();
                     }
@@ -441,7 +413,7 @@ public final class Iterables
         {
             @Override
             @SuppressWarnings( "unchecked" )
-            public TO map( FROM from )
+            public TO apply( FROM from )
             {
                 return (TO) from;
             }
@@ -578,7 +550,7 @@ public final class Iterables
         return map( new Function<T, T>()
         {
             @Override
-            public T map( T t )
+            public T apply( T t )
             {
                 if( functions.length == 0 )
                 {
@@ -590,7 +562,7 @@ public final class Iterables
                     for( int i = 0; i < functions.length; i++ )
                     {
                         Function<T, String> function = functions[i];
-                        mapped[i] = function.map( t );
+                        mapped[i] = function.apply( t );
                         debugLogger.info( msgFormat.format( mapped ) );
                     }
                 }
@@ -610,7 +582,7 @@ public final class Iterables
         return toString( iterable, new Function<T, String>()
         {
             @Override
-            public String map( T t )
+            public String apply( T t )
             {
                 return t == null ? "[null]" : t.toString();
             }
@@ -627,7 +599,7 @@ public final class Iterables
             {
                 builder.append( separator );
             }
-            builder.append( toStringFunction.map( item ) );
+            builder.append( toStringFunction.apply( item ) );
             first = false;
         }
         return builder.toString();
@@ -709,7 +681,7 @@ public final class Iterables
             public TO next()
             {
                 FROM from = fromIterator.next();
-                return function.map( from );
+                return function.apply( from );
             }
 
             @Override
@@ -726,9 +698,9 @@ public final class Iterables
     {
         private final Iterable<T> iterable;
 
-        private final Specification<? super T> specification;
+        private final Predicate<? super T> specification;
 
-        private FilterIterable( Iterable<T> iterable, Specification<? super T> specification )
+        private FilterIterable( Iterable<T> iterable, Predicate<? super T> specification )
         {
             this.iterable = iterable;
             this.specification = specification;
@@ -745,13 +717,13 @@ public final class Iterables
         {
             private final Iterator<T> iterator;
 
-            private final Specification<? super T> specification;
+            private final Predicate<? super T> specification;
 
             private T currentValue;
             boolean finished = false;
             boolean nextConsumed = true;
 
-            private FilterIterator( Iterator<T> iterator, Specification<? super T> specification )
+            private FilterIterator( Iterator<T> iterator, Predicate<? super T> specification )
             {
                 this.specification = specification;
                 this.iterator = iterator;
@@ -763,7 +735,7 @@ public final class Iterables
                 while( !found && iterator.hasNext() )
                 {
                     T currentValue = iterator.next();
-                    boolean satisfies = specification.satisfiedBy( currentValue );
+                    boolean satisfies = specification.test( currentValue );
 
                     if( satisfies )
                     {

http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/9479a63e/core/functional/src/main/java/org/qi4j/functional/Specification.java
----------------------------------------------------------------------
diff --git a/core/functional/src/main/java/org/qi4j/functional/Specification.java b/core/functional/src/main/java/org/qi4j/functional/Specification.java
deleted file mode 100644
index 93c61a9..0000000
--- a/core/functional/src/main/java/org/qi4j/functional/Specification.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2010, Rickard Öberg. All Rights Reserved.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.qi4j.functional;
-
-/**
- * Generic specification interface.
- *
- * @param <T>
- */
-// START SNIPPET: specification
-public interface Specification<T>
-{
-// END SNIPPET: specification
-
-    /**
-     * Test whether an item matches the given specification
-     *
-     * @param item the item to be tested
-     *
-     * @return true if the item matches, false otherwise
-     */
-// START SNIPPET: specification
-    boolean satisfiedBy( T item );
-}
-// END SNIPPET: specification