Are there any performance concerns with using anonymous classes to achieve lazy evaluation of arguments in Java? It seems like each object would be created every time this code is called and then they would all be GCed afterwards.
Example:
a.func(
new Lazy1() {
public void func1() {
call1();
}
},
new Lazy2() {
public void func2() {
call2();
}
});
where func
calls either func1
or func2
depending on some field of a
.