hg: lambda/lambda/jdk: Update initial lambda APIs and tests to use new syntax.

Rémi Forax forax at univ-mlv.fr
Sun Sep 11 07:47:43 PDT 2011


On 09/11/2011 03:04 PM, Brian Goetz wrote:
> Patch eaten by mailing list :(

ok, patch inlined

Rémi

diff --git a/src/share/classes/java/util/functions/Block.java 
b/src/share/classes/java/util/functions/Block.java
--- a/src/share/classes/java/util/functions/Block.java
+++ b/src/share/classes/java/util/functions/Block.java
@@ -56,7 +56,7 @@
       * @return a Block which performs in sequence the {@code apply} 
method of
       * this Block and the {@code apply} method of the specified Block 
operation
       */
- <B extends Block<? super T>> Block<T> chain(B second) default 
Blocks.chain;
+    Block<T> chain(Block<? super T> second) default Blocks.chain;

      /**
       * Returns a Block which performs in sequence the {@code apply} 
methods of
@@ -68,7 +68,7 @@
       * this Block and the {@code apply} methods of the specified Block
       * operations
       */
- <B extends Block<? super T>> Block<T> chain(B... sequence) default 
Blocks.chain;
+    Block<T> chain(Block<? super T>... sequence) default Blocks.chain;

      /**
       * Returns a Block which performs in sequence the {@code apply} 
methods of
@@ -80,7 +80,7 @@
       * this Block and the {@code apply} methods of the specified Block
       * operations
       */
- <B extends Block<? super T>> Block<T> chain(Iterable<B> sequence) 
default Blocks.chain;
+    Block<T> chain(Iterable<? extends Block<? super T>> sequence) 
default Blocks.chain;

      /**
       * Returns a Block which repeatedly performs the {@code apply} 
method of
diff --git a/src/share/classes/java/util/functions/Blocks.java 
b/src/share/classes/java/util/functions/Blocks.java
--- a/src/share/classes/java/util/functions/Blocks.java
+++ b/src/share/classes/java/util/functions/Blocks.java
@@ -87,8 +87,8 @@
       * @return a Block which performs in sequence the {@code first} and
       * {@code second} Blocks
       */
-    public static <B extends Block<? super T>, T> Block<T> chain(
-            B first, B second) {
+    public static Block<T> chain(
+            Block<? super T> first, Block<? super T> second) {
          Objects.requireNonNull(first);
          Objects.requireNonNull(second);

@@ -112,7 +112,7 @@
       * operations
       */
      @SafeVarargs
-    public static <B extends Block<? super T>, T> Block<T> chain(B... 
sequence) {
+    public static <T> Block<T> chain(Block<? super T>... sequence) {
          Objects.requireNonNull(sequence);
          if(0 == sequence.length) {
              return nop();
@@ -133,17 +133,14 @@
       * @param sequence additional Blocks to be chained after the first 
Block. A
       * copy is made of the sequence
       * @return  a block that when applied to a {@code t} applies all 
of the
-     * specified blocks in sequential oder
+     * specified blocks in sequential order
       */
       @SafeVarargs
-     public static <B extends Block<? super T>, T> Block<T> chain(
-            B first, B... sequence) {
+     public static <T> Block<T> chain(
+            Block<? super T> first, Block<? super T>... sequence) {
          Objects.requireNonNull(first);
          Objects.requireNonNull(sequence);
-        if(0 == sequence.length) {
-            return (Block<T>) first;
-        }
-
+
          return t -> {
              first.apply(t);
              for (B block : sequence)
@@ -159,14 +156,11 @@
       * @param components The blocks to be executed. A copy is made of the
       * components.
       * @return  a block that when applied to a {@code t} applies all 
of the
-     * specified blocks in sequential oder.
+     * specified blocks in sequential order.
       */
-    public static <B extends Block<? super T>, T> Block<T> chain(
-            Iterable<B> sequence) {
+    public static <T> Block<T> chain(
+            Iterable<? extends Block<? super T>> sequence) {
          Objects.requireNonNull(sequence);
-        if(!sequence.iterator().hasNext()) {
-            return nop();
-        }

          return t -> {
              for (B block : sequence)
@@ -183,10 +177,10 @@
       * @param components The blocks to be executed. A copy is made of the
       * components.
       * @return a block that when applied to a {@code t} applies all of 
the
-     * specified blocks in sequential oder.
+     * specified blocks in sequential order.
       */
-     public static <B extends Block<? super T>, T> Block<T> chain(
-             Block<? super T> first, Iterable<B> sequence) {
+     public static <T> Block<T> chain(
+             Block<? super T> first, Iterable<? extends Block<? super 
T>> sequence) {
          Objects.requireNonNull(first);
          Objects.requireNonNull(sequence);
          if(!sequence.iterator().hasNext()) {
@@ -214,8 +208,9 @@
          if(times < 0) { throw new IllegalArgumentException("negative 
times");}

          return t -> {
-            for (int i = 0; i < times; i++)
+            for (int i = 0; i < times; i++) {
                  block.apply(t);
+            }
          };
      }

@@ -230,13 +225,14 @@
       * @return a Block which repeatedly performs the {@code apply} 
method of
       * this Block.
       */
-    public static <T> Block<T> whileRepeat(Block<T> block, Predicate<? 
super T> decider) {
+    public static <T> Block<T> whileRepeat(Block<? super T> block, 
Predicate<? super T> decider) {
          Objects.requireNonNull(block);
          Objects.requireNonNull(decider);

          return t -> {
-            while (decider.eval(t))
+            while (decider.eval(t)) {
                  block.apply(t);
+            }
          };
      }

@@ -251,7 +247,7 @@
       * @return a Block which repeatedly performs the {@code apply} 
method of
       * this Block.
       */
-    public static <T> Block<T> repeatUntil(Block<T> block, Predicate<? 
super T> decider) {
+    public static <T> Block<T> repeatUntil(Block<? super T> block, 
Predicate<? super T> decider) {
          Objects.requireNonNull(block);
          Objects.requireNonNull(decider);

diff --git a/src/share/classes/java/util/functions/Mappers.java 
b/src/share/classes/java/util/functions/Mappers.java
--- a/src/share/classes/java/util/functions/Mappers.java
+++ b/src/share/classes/java/util/functions/Mappers.java
@@ -41,13 +41,13 @@
       * A mapper which who's {@code map} method returns the provided
       * input.
       */
-    public static final Mapper<Object, Object> IDENTITY = t -> t;
+    private static final Mapper<Object, Object> IDENTITY = t -> t;

      /**
       * A mapper which performs a mapping from an object to it's
       * string representation.
       */
-    public static final Mapper<Object, String> STRING =
+    private static final Mapper<Object, String> STRING =
          t -> String.valueOf(t);

      /**
@@ -150,11 +150,11 @@
       * @throws NoSuchMethodException when {@code <U>} has no 
constructor which
       * takes a {@code <T>} as a parameter.
       */
-    public static <T, U> Mapper<T, U> instantiate(final Class<? extends 
T> clazzT, final Class<? extends U> clazzU) {
+    public static <T, U> Mapper<T, U> instantiate(Class<? extends T> 
clazzT, Class<? extends U> clazzU) {
          Objects.requireNonNull(clazzT);
          Objects.requireNonNull(clazzU);

-        final Constructor<? extends U> constructor;
+        Constructor<? extends U> constructor;
          try {
              constructor = clazzU.getConstructor(clazzT);
          } catch(NoSuchMethodException noConstructor) {
@@ -184,7 +184,7 @@
       * @throws IllegalArgumentException for all values of {@code <T>} not
       * present in the map
       */
-    public static <T, U> Mapper<T, U> forMap(final Map<? super T, ? 
extends U> map) {
+    public static <T, U> Mapper<T, U> forMap(Map<? super T, ? extends 
U> map) {
          Objects.requireNonNull(map);

          return t -> {
@@ -208,13 +208,9 @@
       * @param defaultValue the value returned by {@code map} method for
       * {code <T>} values not contained in the provided map
       */
-    public static <T, U> Mapper<T, U> forMap(final Map<? super T, ? 
extends U> map, final U defaultValue) {
+    public static <T, U> Mapper<T, U> forMap(Map<? super T, ? extends 
U> map, U defaultValue) {
          Objects.requireNonNull(map);

-        if(map.isEmpty()) {
-            return constant(defaultValue);
-        }
-
          return t -> map.containsKey(t) ? map.get(t) : defaultValue;
      }

diff --git a/src/share/classes/java/util/functions/Predicates.java 
b/src/share/classes/java/util/functions/Predicates.java
--- a/src/share/classes/java/util/functions/Predicates.java
+++ b/src/share/classes/java/util/functions/Predicates.java
@@ -40,24 +40,24 @@
       * a predicate that evaluates to {@code true} if the reference
       * being tested is {@code null}.
       */
-    public static final Predicate<Object> IS_NULL = t -> t == null;
+    private static final Predicate<Object> IS_NULL = t -> t == null;

      /**
       * a predicate that evaluates to {@code true} if the reference
       * being tested is not {@code null}.
       */
-    public static final Predicate<Object> NON_NULL = t -> t != null;
+    private static final Predicate<Object> NON_NULL = t -> t != null;

      /**
       * a predicate who's result is always {@code false}.
       */
-    public static final Predicate<Object> FALSE = t -> false;
+    private static final Predicate<Object> FALSE = t -> false;


      /**
       * a predicate who's result is always {@code true}.
       */
-    public static final Predicate<Object> TRUE = t -> true;
+    private static final Predicate<Object> TRUE = t -> true;

      /**
       * singleton utils
@@ -73,8 +73,8 @@
       * @return a predicate that evaluates to {@code true} if the 
reference
       * being tested is {@code null}
       */
-    public static Predicate<Object> isNull() {
-        return IS_NULL;
+    public static <T> Predicate<T> isNull() {
+        return (Predicate<T>)IS_NULL;
      }

      /**
@@ -84,8 +84,8 @@
       * @return a predicate that evaluates to {@code true} if the 
reference
       * being tested is is non-{@code null}
       */
-    public static Predicate<Object> nonNull() {
-        return NON_NULL;
+    public static <T> Predicate<T> nonNull() {
+        return (Predicate<T>)NON_NULL;
      }

      /**
@@ -93,8 +93,8 @@
       *
       * @return a predicate that always evaluates to {@code false}.
       */
-    public static Predicate<Object> alwaysFalse() {
-        return FALSE;
+    public static <T> Predicate<T> alwaysFalse() {
+        return (Predicate<T>)FALSE;
      }

      /**
@@ -102,8 +102,8 @@
       *
       * @return a predicate that always evaluates to {@code true}.
       */
-    public static Predicate<Object> alwaysTrue() {
-        return TRUE;
+    public static <T> Predicate<T> alwaysTrue() {
+        return (Predicate<T>)TRUE;
      }

      /**
@@ -115,7 +115,7 @@
       * @return a predicate that evaluates to {@code true} if the 
object being
       * tested is an instance of the provided class
       */
-    public static Predicate<Object> instanceOf(Class<?> clazz) {
+    public static <T> Predicate<T> instanceOf(Class<?> clazz) {
          return o -> clazz.isInstance(o);
      }

@@ -125,7 +125,7 @@
       * @param target The target value to be compared for identity 
equality.
       * @return a predicate that who's result is {@code target == object}.
       */
-    public static Predicate<Object> isSame(Object target) {
+    public static <T> Predicate<T> isSame(Object target) {
          return obj -> obj == target;
      }

@@ -136,7 +136,7 @@
       * @param t The target value to be compared for equality.
       * @return a predicate who's result matches {@code 
Objects.equals(target, t)}
       */
-    public static Predicate<Object> isEqual(Object target) {
+    public static <T> Predicate<T> isEqual(Object target) {
          if (null == target)
              return Predicates.isNull();
          else
@@ -155,7 +155,7 @@
       * is a member of the provided collection. The collection is not 
defensively
       * copied so changes to it will alter the behavior of the predicate.
       */
-    public static <T> Predicate<T> contains(Collection<? super T> 
target) {
+    public static <T> Predicate<T> contains(Collection<?> target) {
          return t -> target.contains(t);
      }

@@ -166,7 +166,7 @@
       * @return the composition of the provided mapper and predicate
       */
      public static <T, V> Predicate<T> compose(
-            Predicate<V> predicate, Mapper<T, ? extends V> mapper) {
+            Predicate<? super V> predicate, Mapper<? super T, ? extends 
V> mapper) {
          return t -> predicate.eval(mapper.map(t));
      }

@@ -180,8 +180,8 @@
       * @return A predicate who's result is the logical inverse of the 
provided
       * predicate.
       */
-    public static <T, P extends Predicate<? super T>> Predicate<T> negate(
-            P predicate) {
+    public static <T> Predicate<T> negate(
+            Predicate<? super T> predicate) {
          return t -> !predicate.eval(t);
      }

@@ -198,12 +198,8 @@
       * @return A predicate who's result is {@code true} iff all component
       * predicates are {@code true}.
       */
-    public static <T, P extends Predicate<? super T>> Predicate<T> and(
-            Predicate<T> first,  P second) {
-        if((null != first) && (first == second)) {
-            return (Predicate<T>) first;
-        }
-
+    public static <T> Predicate<T> and(
+            Predicate<? super T> first,  Predicate<? super T> second) {
          Objects.requireNonNull(first);
          Objects.requireNonNull(second);

@@ -222,13 +218,10 @@
       * @return A predicate who's result is {@code true} iff all component
       * predicates are {@code true}.
       */
-    public static <T, P extends Predicate<? super T>> Predicate<T> and(
-            Iterable<P> predicates) {
+    public static <T> Predicate<T> and(
+            Iterable<? extends Predicate<? super T>> predicates) {
          Objects.requireNonNull(predicates);
-        if (!predicates.iterator().hasNext()) {
-            throw new IllegalArgumentException("no predicates");
-        }
-
+
          return t -> {
              for (P predicate : predicates) {
                  if (!predicate.eval(t)) {
@@ -252,13 +245,10 @@
       * @return A predicate who's result is {@code true} iff all component
       * predicates are {@code true}.
       */
-     static <T, P extends Predicate<? super T>> Predicate<T> and(
-            P first, Iterable<P> predicates) {
+     static <T> Predicate<T> and(
+            P first, Iterable<? extends Predicate<? super T>> 
predicates) {
          Objects.requireNonNull(first);
          Objects.requireNonNull(predicates);
-        if(!predicates.iterator().hasNext()) {
-            return (Predicate<T>) first;
-        }

          return t -> {
              if (!first.eval(t)) {
@@ -286,8 +276,8 @@
       * predicates are {@code true}.
       */
       @SafeVarargs
-    public static <T, P extends Predicate<? super T>> Predicate<T> and(
-            P... predicates) {
+    public static <T> Predicate<T> and(
+             Predicate<? super T>... predicates) {
          return and(Arrays.asList(predicates));
      }
      /**
@@ -304,8 +294,8 @@
       * predicates are {@code true}.
       */
       @SafeVarargs
-     static <T, P extends Predicate<? super T>> Predicate<T> and(
-            P first, P... predicates) {
+     static <T> Predicate<T> and(
+            Predicate<? super T> first, Predicate<? super T>... 
predicates) {
          return and(first, Arrays.asList(predicates));
      }

@@ -322,12 +312,8 @@
       * @return A predicate who's result is {@code true} if any component
       * predicate's result is {@code true}.
       */
-    public static <T, P extends Predicate<? super T>> Predicate<T> or(
-            Predicate<T> first,  P second) {
-        if((null != first) && (first == second)) {
-            return (Predicate<T>) first;
-        }
-
+    public static <T> Predicate<T> or(
+            Predicate<? super T> first,  Predicate<? super T> second) {
          Objects.requireNonNull(first);
          Objects.requireNonNull(second);

@@ -346,13 +332,10 @@
       * @return A predicate who's result is {@code true} if any component
       * predicate's result is {@code true}.
       */
-    public static <T, P extends Predicate<? super T>> Predicate<T> or(
-            Iterable<P> predicates) {
+    public static <T> Predicate<T> or(
+            Iterable<? extends Predicate<? super T>> predicates) {
          Objects.requireNonNull(predicates);
-        if (!predicates.iterator().hasNext()) {
-            throw new IllegalArgumentException("no predicates");
-        }
-
+
          return t -> {
              for (P predicate : predicates) {
                  if (predicate.eval(t)) {
@@ -375,14 +358,11 @@
       * @return A predicate who's result is {@code true} if any component
       * predicate's result is {@code true}.
       */
-     static <T, P extends Predicate<? super T>> Predicate<T> or(
-            P first, Iterable<P> predicates) {
+     static <T> Predicate<T> or(
+            Predicate<? super T> first, Iterable<? extends Predicate<? 
super T>> predicates) {
          Objects.requireNonNull(first);
          Objects.requireNonNull(predicates);
-        if (!predicates.iterator().hasNext()) {
-            return (Predicate<T>) first;
-        }
-
+
          return t -> {
              if (first.eval(t)) {
                  return true;
@@ -409,8 +389,8 @@
       * predicate's result is {@code true}.
       */
       @SafeVarargs
-     public static <T, P extends Predicate<? super T>> Predicate<T> or(
-            P... predicates) {
+     public static <T> Predicate<T> or(
+            Predicate<? super T>... predicates) {
           return or(Arrays.asList(predicates));
       }

@@ -426,8 +406,8 @@
       * predicate's result is {@code true}.
       */
       @SafeVarargs
-     static <T, P extends Predicate<? super T>> Predicate<T> or(
-            P first, P... predicates) {
+     static <T> Predicate<T> or(
+            Predicate<? super T> first, Predicate<? super T>... 
predicates) {
          return or(first, Arrays.asList(predicates));
      }

@@ -444,12 +424,8 @@
       * @return  a predicate that evaluates to {@code false} if all or 
none of
       * the component predicates evaluate to {@code true}
       */
-    public static <T, P extends Predicate<? super T>> Predicate<T> xor(
-            Predicate<T> first, P second) {
-        if((null != first) && (first == second)) {
-            return (Predicate<T>) alwaysFalse();
-        }
-
+    public static <T> Predicate<T> xor(
+            Predicate<? super T> first, Predicate<? super T> second) {
          Objects.requireNonNull(first);
          Objects.requireNonNull(second);

@@ -468,25 +444,23 @@
       * @return  a predicate that evaluates to {@code false} if all or 
none of
       * the component predicates evaluate to {@code true}
       */
-    public static <T, P extends Predicate<? super T>> Predicate<T> xor(
-            Iterable<P> predicates) {
+    public static <T> Predicate<T> xor(
+            Iterable<? extends Predicate<? super T>> predicates) {
          Objects.requireNonNull(predicates);
-        if(!predicates.iterator().hasNext()) {
-            throw new IllegalArgumentException("no predicates");
-        }
+

          return t -> {
-            Boolean initial = null;
-            for (P predicate : predicates) {
-                if (null == initial) {
-                    initial = predicate.eval(t);
-                } else {
-                    if (!(initial ^ predicate.eval(t))) {
-                        return true;
-                    }
+            Iterator<T> iterator = predicates.iterator();
+            if (!iterator.hasNext()) {
+                return false;
+            }
+            boolean initial = iterator.next().eval(t);
+            while(iterator.hasNext()) {
+                if (!(initial ^ iterator.next().eval(t))) {
+                    return true;
                  }
              }
-            return false;
+            return value;
           };
      }

@@ -502,8 +476,8 @@
       * @return  a predicate that evaluates to {@code false} if all or 
none of the
       * component predicates evaluate to {@code true}
       */
-    static <T, P extends Predicate<? super T>> Predicate<T> xor(
-            P first, Iterable<P> predicates) {
+    static Predicate<T> xor(
+            P first, Iterable<? extends Predicate<? super T>> 
predicates) {
          Objects.requireNonNull(first);
          Objects.requireNonNull(predicates);

@@ -531,7 +505,7 @@
       * component predicates evaluate to {@code true}
       */
      @SafeVarargs
-    public static <T, P extends Predicate<? super T>> Predicate<T> 
xor(P... predicates) {
+    public static <T> Predicate<T> xor(Predicate<? super T>... 
predicates) {
          return xor(Arrays.asList(predicates));
      }

@@ -548,8 +522,8 @@
       * component predicates evaluate to {@code true}
       */
      @SafeVarargs
-     static <T, P extends Predicate<? super T>> Predicate<T> xor(
-            P first, P... predicates) {
+     static <T> Predicate<T> xor(
+            P first, Predicate<? super T>... predicates) {
          return xor(first, Arrays.asList(predicates));
      }
  }
diff --git a/src/share/classes/java/util/functions/Reducers.java 
b/src/share/classes/java/util/functions/Reducers.java
--- a/src/share/classes/java/util/functions/Reducers.java
+++ b/src/share/classes/java/util/functions/Reducers.java
@@ -38,7 +38,7 @@
      /**
       * A reducer who's {@code reduce} method always returns the base.
       */
-    public static final Reducer<Object,Object> NOP = (u, t) -> u;
+    private static final Reducer<Object,Object> NOP = (u, t) -> u;

      /**
       * Only utility methods.
@@ -92,7 +92,7 @@
       * @return the composition of the provided mapper and reducer.
       */
      public static <T, U, V> Reducer<V, U> compose(
-            Reducer<T, U> reducer, Mapper<? super V, ? extends T> 
mapper) {
+            Reducer<? super T, U> reducer, Mapper<? super V, ? extends 
T> mapper) {
          Objects.requireNonNull(reducer);
          Objects.requireNonNull(mapper);

@@ -116,7 +116,7 @@
       * reducer.
       */
      public static <T, U> Reducer<T,U> compose(
-            Reducer<T, U> reducer, Predicate<? super T> predicate) {
+            Reducer<? super T, U> reducer, Predicate<? super T> 
predicate) {
          Objects.requireNonNull(reducer);
          Objects.requireNonNull(predicate);


>
> On 9/11/2011 7:59 AM, Rémi Forax wrote:
>> better with the patch
>>
>> Rémi
>>
>> On 09/11/2011 01:52 PM, Rémi Forax wrote:
>>> Hi all,
>>> I've tried to fix some bugs of the current implementation of
>>> java.util.functions.
>>>
>>> - some constants are still public
>>> (BTW, when the compiler will be able to generate the correct bytecode
>>> for a lambda, these constants will be not needed any more
>>> because constant lambda will be constant by default)
>>> - a lot of generic signature aren't right and there is inconsistency
>>> between the files.
>>> - some casts are wrong, you can't cast a Predicate<? super T> to
>>> a Predicate<T>, it's not safe.
>>> - some methods return a Predicate<Object> instead of a
>>> Predicate<T> so it will not work if the predicate is used by example
>>> in a ?:
>>> - some short cuts in the implementation are wrong (by example,
>>> testing if there is an element in an iterable before creating
>>> the lambda is wrong because the iterable can be populated
>>> before the lambda is called.
>>> - fix some implementations, BTW I think the methods xor should be 
>>> removed
>>> for the same reason there is no ^^ in C
>>> (nobody use xor in test between booleans)
>>>
>>> cheers,
>>> Rémi
>>>
>>> On 09/10/2011 03:49 AM, stuart.marks at oracle.com wrote:
>>>> Changeset: d9e4e3c106a7
>>>> Author: smarks
>>>> Date: 2011-09-09 18:48 -0700
>>>> URL: http://hg.openjdk.java.net/lambda/lambda/jdk/rev/d9e4e3c106a7
>>>>
>>>> Update initial lambda APIs and tests to use new syntax.
>>>>
>>>> ! src/share/classes/java/util/functions/Blocks.java
>>>> ! src/share/classes/java/util/functions/Mappers.java
>>>> ! src/share/classes/java/util/functions/Predicates.java
>>>> ! src/share/classes/java/util/functions/Reducers.java
>>>> ! test/java/util/Collection/Extensions.java
>>>> ! test/java/util/Collection/MOAT.java
>>>> ! test/java/util/List/Extensions.java
>>>> ! test/java/util/functions/Block/BlocksTest.java
>>>> ! test/java/util/functions/Mapper/MappersTest.java
>>>> ! test/java/util/functions/Predicate/PredicatesTest.java
>>>> ! test/java/util/functions/Reducer/ReducersTest.java
>>>>
>>>>
>>>
>>
>>
>>
>>



>
> On 9/11/2011 7:59 AM, Rémi Forax wrote:
>> better with the patch :)
>>
>> Rémi
>>
>> On 09/11/2011 01:52 PM, Rémi Forax wrote:
>>> Hi all,
>>> I've tried to fix some bugs of the current implementation of
>>> java.util.functions.
>>>
>>> - some constants are still public
>>> (BTW, when the compiler will be able to generate the correct bytecode
>>> for a lambda, these constants will be not needed any more
>>> because constant lambda will be constant by default)
>>> - a lot of generic signature aren't right and there is inconsistency
>>> between the files.
>>> - some casts are wrong, you can't cast a Predicate<? super T> to
>>> a Predicate<T>, it's not safe.
>>> - some methods return a Predicate<Object> instead of a
>>> Predicate<T> so it will not work if the predicate is used by example
>>> in a ?:
>>> - some short cuts in the implementation are wrong (by example,
>>> testing if there is an element in an iterable before creating
>>> the lambda is wrong because the iterable can be populated
>>> before the lambda is called.
>>> - fix some implementations, BTW I think the methods xor should be 
>>> removed
>>> for the same reason there is no ^^ in C
>>> (nobody use xor in test between booleans)
>>>
>>> cheers,
>>> Rémi
>>>
>>> On 09/10/2011 03:49 AM, stuart.marks at oracle.com wrote:
>>>> Changeset: d9e4e3c106a7
>>>> Author: smarks
>>>> Date: 2011-09-09 18:48 -0700
>>>> URL: http://hg.openjdk.java.net/lambda/lambda/jdk/rev/d9e4e3c106a7
>>>>
>>>> Update initial lambda APIs and tests to use new syntax.
>>>>
>>>> ! src/share/classes/java/util/functions/Blocks.java
>>>> ! src/share/classes/java/util/functions/Mappers.java
>>>> ! src/share/classes/java/util/functions/Predicates.java
>>>> ! src/share/classes/java/util/functions/Reducers.java
>>>> ! test/java/util/Collection/Extensions.java
>>>> ! test/java/util/Collection/MOAT.java
>>>> ! test/java/util/List/Extensions.java
>>>> ! test/java/util/functions/Block/BlocksTest.java
>>>> ! test/java/util/functions/Mapper/MappersTest.java
>>>> ! test/java/util/functions/Predicate/PredicatesTest.java
>>>> ! test/java/util/functions/Reducer/ReducersTest.java
>>>>
>>>>
>>>
>>
>>
>>
>>



More information about the lambda-dev mailing list