|
|
|
|
|
by vbezhenar
3030 days ago
|
|
I don't like the fact that `var` breaks class hierarchy. I can write `List l = getList()` and then variable `l` will have only methods from `List`. If I'll decide to change `getList()` return type, it'll be easier to migrate the code. With `var` variable `l` probably will have something like `ArrayList` type and I can accidentally use methods from `ArrayList`, even if I don't really need them, tying this code to concrete class. It's obvious that everyone will use `var` everywhere, so using `var` in one place and explicit type declaration in another probably would be even worse. |
|