3 ms·
A static class method is exactly the same as a free-standing function, it's just in the class namespace. I don't see why you think that means you can't have fun
by IshKebab 5y ago
A static class method is exactly the same as a free-standing function, it's just in the class namespace. I don't see why you think that means you can't have function composition.
- gowld 5y agoNot true. It's not first class. You can't pass a static class method to a method and then call it. You have to instantiate a Function instance or equivalent.
- IshKebab 5y agoOk but that's a separate weird limitation that only applies to Java. You can pass static methods as parameters in at least C++, Python and Javascript.
- UncleMeat 5y agoThat is orthogonal. Java could easily have free standing functions that are still not first class.
- native_samples 5y agoThat's not actually true. You can use method handles to do that.
- nine_k 5y agoOnly if you mark that class with `@FunctionalInterface`. Unfortunately, methods are not first-class objects in Java (while classes, with .class, are).