Commits

Stepan Koltsov  committed ce3647d

widen foldLeft, foldRight parmeter types

  • Participants
  • Parent commits 8ed359a

Comments (0)

Files changed (4)

File src/main/java/ru/yandex/bolts/collection/ListF.java

 
 
     /** Fold right */
-    <B> B foldRight(B z, Function2<E, B, B> f);
+    <B> B foldRight(B z, Function2<? super E, ? super B, B> f);
 
     <B> B foldRightW(B z, @FunctionParameter B f);
 

File src/main/java/ru/yandex/bolts/collection/impl/AbstractListF.java

     }
 
     @Override
-    public <B> B foldRight(B z, Function2<E, B, B> f) {
+    public <B> B foldRight(B z, Function2<? super E, ? super B, B> f) {
         return reverseIterator().foldLeft(z, f.swap());
     }
 

File src/main/java/ru/yandex/bolts/collection/impl/AbstractTraversableF.java

     }
 
     @Override
-    public <B> B foldLeft(B z, Function2<B, E, B> f) {
+    public <B> B foldLeft(B z, Function2<? super B, ? super E, B> f) {
         IteratorF<E> i = iterator();
         B acc = z;
         while (i.hasNext()) {

File src/main/java/ru/yandex/bolts/collection/impl/TraversableF.java

     E single();
 
     /** Fold left */
-    <B> B foldLeft(B z, Function2<B, E, B> f);
+    <B> B foldLeft(B z, Function2<? super B, ? super E, B> f);
 
     <B> B foldLeftW(B z, @FunctionParameter B f);