34 ms·
Not really a place for it in a strongly typed language like Java :/ I could maybe see language support for creating Maps or something, but in Java you're suppos
by exabrial 12y ago
Not really a place for it in a strongly typed language like Java :/ I could maybe see language support for creating Maps or something, but in Java you're supposed to create your own Objects and let the compiler check your code for errors.
- pswenson 12y agoI assume you meant statically typed, rather than strongly typed. Swift has this: var airports: [String: String] = ["TYO": "Tokyo", "DUB": "Dublin"]
- exabrial 12y ago:D Thanks for the correction I like the swift example... Map<String, String> map = new HashMap<>(){"TYO": "Tokyo", "DUB": "Dublin"};
- dragonwriter 12y agoA hash literal syntax in a strong, statically typed language works just fine; conceptually, they aren't much different in that regard than array literals, which Java already has.