Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/337#discussion_r159528932
  
    --- Diff: jena-base/src/main/java/org/apache/jena/atlas/lib/Pair.java ---
    @@ -37,6 +40,30 @@
         public A car() { return a ; }
         public B cdr() { return b ; }
         
    +    public static class OfSameType<T> extends Pair<T, T> {
    +
    --- End diff --
    
    Point 3 was the observation 
    
    ```
    public <S, X> S apply(BiFunction<X, X, S> f, Function<T, X> op) {
             return f.apply(op.apply(a), op.apply(b));
         }
    ```
    could be a function that can acts on `Pair<X,X>`.
    ```
    static public <S, X> S apply(Pair<X,X> pair, BiFunction<X, X, S> f, 
Function<T, X> op) {
        return f.apply(op.apply(pair.car()), op.apply(pair.cdr()));
    }
    ```
    now whether `<S, X>` can meaningfully/usefully be `<S, X extends FOO>` and 
interface FOO defines the "to boolean" method, 
    
    I don't usually push generics very hard - I leave that to Scala.
    



---

Reply via email to