title: What is the time cost of creating a String in Java, with respect to JVM's string pool?
body: <p>Java has a string pool and therefore before a new string is actually created I guess there is a check to see if the same string already exists, what is the cost of this call? </p>
  
  <p>Is the pool a hash or tree based structure?</p>
  
  <p>In either case I guess comes down to the performance of the String hash code, as search trees use hash code as a key? </p>
  
  <p>I'm guessing its about log n, where n is the number of strings currently on the heap.</p>