lambda/method refs: more specific according to 15.12.2.5 - prefer private when private type is given/reference when reference type is given

This commit is contained in:
anna
2013-02-27 18:00:45 +01:00
parent 47c7983713
commit a55b0fa17b
3 changed files with 80 additions and 9 deletions

View File

@@ -0,0 +1,29 @@
class Test {
static class Inner {
int foo() { return 0; }
Integer fooBoxed() { return 0; }
}
void test(Stream<Inner> sp) {
IntStream mi = sp.map(Inner::foo);
Stream<Integer> mI = sp.map(Inner::fooBoxed);
IntStream li = sp.map(inner->inner.foo());
Stream<Integer> lI = sp.map(inner -> inner.fooBoxed());
}
interface Stream<T> {
<R> Stream<R> map(Function<? super T, ? extends R> mapper);
IntStream map(IntFunction<? super T> mapper);
}
interface Function<T, R> {
public R _(T t);
}
interface IntFunction<T> {
public int _(T t);
}
interface IntStream {}
}