3 ms·
If you know you’re creating a List (it’s there on the LHS) why not write List.empty()?
by chrisseaton 7y ago
If you know you’re creating a List (it’s there on the LHS) why not write List.empty()?
- james-mcelwain 7y agoHere's how it works in Rust. You can imagine this working in Java with reified generics: https://gist.github.com/rust-play/214adf5bd15b18ec2d5c63d97ff8ba2c https://gist.github.com/rust-play/214adf5bd15b18ec2d5c63d97f....
- verdagon 7y agoFascinating! What are the uses of something like this? Is this at all related to concepts or metaprogramming?
- TheCoelacanth 7y agoYou know in this specific example, but not always. You could also do it in generic method where the collection type is parameterized.