Java documentation says
The Java compiler generates generally more efficient bytecode from switch statements that use String objects than from chaine
This is a bytecode fragment generated from example in the docs:
INVOKEVIRTUAL java/lang/String.hashCode ()I LOOKUPSWITCH -2049557543: L2 -1984635600: L3 -1807319568: L4
using LOOKUPSWITCH has better perfomance compared to if-else logic