5 ms·
I'd rather they didn't. It would be redundant with inner classes that are already there, I don't like this piling up of features. It would be more interesting i
by EdiX 15y ago
I'd rather they didn't. It would be redundant with inner classes that are already there, I don't like this piling up of features. It would be more interesting if they allowed inner classes to close over non-final variables.
- ramblerman 15y agoAn inner class is the ugly half-brother of a closure. 99% of the time they're used they define just one method. When they are used for more than 1 method implementations, well ... they shouldn't be inner classes. They just exist to fill the gap of having no closures. I say this as a long time and affectionate java user but project lambda in JDK8 is long overdue.
- EdiX 15y agoThey are there, they have been there for over ten years, much code exists that needs them to be there. You can't take them out of the language. More syntax sugar for them would be good, adding first class functions IMHO isn't good.
- yummyfajitas 15y agoWhen they are used for more than 1 method implementations, well ... they shouldn't be inner classes. Why not? Very often, a class will have some data members which are pretty much meaningless elsewhere. Why should the class used to represent that data be exposed elsewhere?