This content has been marked as final. Show 1 reply
sinhasaurabhy2k wrote:Not exactly sure what you mean - a jump is a jump.
In reference to the new feature of switch taking Case value as String.
1) Does it make direct jumps like in the case of int?
However since the bytes codes have not change there is no string table byte code (so ie no 'lookupswitch'), which probably means the most likely implementation is just a sequence of ifs.
2) Which one is faster the int or the string? I feel it could be same if it directly jumps.Hardly since the string comparison takes longer.
3) Are these String kept into the "String Pool" or kind of place.Literals are always in the pool.
In other words how much it impact on memory?If you have enough switch statements with strings versus object creation that you can even measure the usage I would suspect that your design is broken. Badly broken.