alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (T8016177a.java)

This example Java source code file (T8016177a.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

function, list, r\,r, t,r, t8016177a, tointfunction, util

The T8016177a.java Java example source code

/*
 * @test /nodynamiccopyright/
 * @bug 8016177 8016178
 * @summary structural most specific and stuckness
 * @compile/fail/ref=T8016177a.out -XDrawDiagnostics T8016177a.java
 */
import java.util.List;

class T8016177a {

    interface ToIntFunction<X> {
        int m(X x);
    }

    interface Function<X, Y> {
        Y m(X x);
    }

    <T,R> void m1(List s, Function f) { }
    <T,R> void m1(List s, ToIntFunction f) { }

    <T,R> List m2(List s, Function f) { return null; }
    <T,R> List m2(List s, ToIntFunction f) { return null; }

    <T,R> List m3(List s, Function f) { return null; }
    <T,R> List m3(List s, ToIntFunction f) { return null; }

    <T,R> List m4(List s, Function f) { return null; }
    <T,R> List m4(List s, ToIntFunction f) { return null; }

    <T,R> List m5(List s, Function f) { return null; }
    <T,R> List m5(List s, ToIntFunction f) { return null; }

    <T extends R,R> List m6(List s, Function f) { return null; }
    <T extends R,R> List m6(List s, ToIntFunction f) { return null; }

    void test(List<String> ss) {
         m1(ss, s->s.length()); //ambiguous
         m2(ss, s->s.length()); //ambiguous
         m3(ss, s->s.length()); //ambiguous
         m4(ss, s->s.length()); //ambiguous
         m5(ss, s->s.length()); //ambiguous
         m6(ss, s->s.length()); //ambiguous
    }
}

Other Java examples (source code examples)

Here is a short list of links related to this Java T8016177a.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.