mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-09 16:39:37 +07:00
method references: super methods treatment in exact check
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class Scratch
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
final List<ConcreteId> list = new ArrayList<>();
|
||||
|
||||
final List<Long> longs = list.stream()
|
||||
.map(ConcreteId::getId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
final List<Long> longs2 = list.stream()
|
||||
.map(AbstractId::getId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static abstract class AbstractId
|
||||
{
|
||||
private final long id;
|
||||
|
||||
public AbstractId(long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public long getId()
|
||||
{
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ConcreteId extends AbstractId
|
||||
{
|
||||
public ConcreteId(long id)
|
||||
{
|
||||
super(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user