I'm in the process of upgrading an application that relies on the Java 7 iteration order of HashMap. The Java 8 HashMap changed its iteration order, which is incompatible with some of this application (probably bad design), I have to use Java 7 HashMaps to successfully migrate the application to Java 8. This is the way I thought of doing it:
Yes, your approach is fine. Though everyone seems to have a feeling of inadequacy. However you want to have only implementation changes:
Map<Lorem, Ipso> goodMap = new HashMap<>(); HashMap<Foo, Bar> badMap = new HashMap<>();
So replace only
new HashMap with
new Java7HashMap finding all misfits, and allowing later consolidation, say with better keys using Comparable.
You probably need just to
implement Map of java 8, and actually I would not even care about missing java 8 support, as it will be working as it did, and a further development should offer a replacement of Java7HashMap. Better invest time in rewrites. A carrot and stick approach.