title: What is the time complexity of Java StringBuilder.substring() method? If it is linear, is there a constant time complexity method to get a substring?
body: <p>In my opinion it should be constant(O(1)) time complexity. However I was told that a new String object has to be instantiated when invoking stringBuilder.substring() method. (It is not static method). If this is true, how can I get a substring within a constant time complexity?</p>