If I have
public interface Foo {
public void oneMethod();
}
And then I have another class:
public class TestClass {
SoftReference sr;
public test() {
doSomething(this::lalala);
}
public lalala() {
}
public doSomethingFoo(Foo foo) {
sr = new SoftReference(foo);
//can sr.get() ever return null?
}
}
Can sr.get()
ever return null?
Also interested to know the behaviour in the case where instead of a method reference we use an anonymous inner class or a non static inner class.