Cast a raw map to a generic map using a method, cleanly and safely in a fail early manner
问题 Casting, instanceof, and @SuppressWarnings("unchecked") are noisy. It would be nice to stuff them down into a method where they won't need to be looked at. CheckedCast.castToMapOf() is an attempt to do that. castToMapOf() is making some assumptions: (1) The map can't be trusted to be homogeneous (2) Redesigning to avoid need for casting or instanceof is not viable (3) Ensuring type safety in an fail early manner is more important than the performance hit (4) Returning Map<String,String> is