A week ago, I published AndroidDeviceNames, a library transforming device models into something people can understand, e.g. SM-N910W8 to Samsung Galaxy Note 4. Some of you did not like the implementation. Here’s the reasoning behind it.
tslamic.github.io/creating-android-device-names/Posted Aug 24, 2015, 11:28 AM UTC
why not just use switch statement over strings and emit Java 7 bytecode? Dexer will allow it and you'll get a bytecode implementation of a hashtable.
Excellent point, and you are absolutely right - the performance would actually be better:
This is entirely my fault - I’m still stuck in the Java 6 era.
yup, and if you look at the bytecode then it'll end up being a switch over String.hashCode() and then a chain of .equals() calls. That's pretty much a hashtable. (See http://stackoverflow.com/questions/10836055/why-is-the-switch-statement-faster-than-if-else-for-string-in-java-7).