The JMH micro benchmark to evaluate switch vs HashMap branching performance for Strings. The test intentionally checks only the worst case scenario - access to the last item.
In order to compile the code you need to install Maven.
Building:
mvn clean install
Running:
java -jar target/benchmarks.jar