A genuinely type safe Map for Java

Steve Neal Java Programming Leave a Comment

The problem: As much as I love generics in Java, it is still necessary to employ evil casts when retrieving different data types from a Map; see lines 13, 14 and 15: Did you spot the bug in this example? The compiler would have missed it. Ideally, I’d much rather work with code like this: In addition to the casts …