4 ms·
You don't have to do this in Java anymore... Structural typing was added in Java 8 and is how method references are generally used. For example I use this often
by meddlepal 9y ago
You don't have to do this in Java anymore... Structural typing was added in Java 8 and is how method references are generally used. For example I use this often to avoid implementing Runnable when I already have a method satisfying the `void run()` contract on an existing implemented but with different name.
Edit: on reflection this may actually be duck typing not structural typing.