Details
Description
A DESCRIPTION OF THE REQUEST :
java.lang.String.indexOf(String str, int fromIndex) uses str.value and so does not need to call str.toCharArray() and therefore does no allocation.
java.lang.StringBuffer.indexOf(String str, int fromIndex) uses str.toCharArray() which allocates a new char array just for the purposes of the call ; if the method is called in a loop with the same str, many "same" allocations can be done ; it would be more optimal to be able to use directly the str value member (through adequate qualifiers / getter).
Same for StringBuilder.
JUSTIFICATION :
Reduce "unnecessary" allocation
java.lang.String.indexOf(String str, int fromIndex) uses str.value and so does not need to call str.toCharArray() and therefore does no allocation.
java.lang.StringBuffer.indexOf(String str, int fromIndex) uses str.toCharArray() which allocates a new char array just for the purposes of the call ; if the method is called in a loop with the same str, many "same" allocations can be done ; it would be more optimal to be able to use directly the str value member (through adequate qualifiers / getter).
Same for StringBuilder.
JUSTIFICATION :
Reduce "unnecessary" allocation