Code example for Interner

Methods: intern

0
   */ 
  public static String strongIntern(String sample) {
    if (sample == null) {
      return null; 
    } 
    return strongInterner.intern(sample);
  } 
   
  /** 
   * Interns and returns a reference to the representative instance  
   * for any of a collection of string instances that are equal to each other. 
   * Retains weak reference to the instance,  
   * and so does not prevent it from being garbage-collected. 
   *  
   * @param sample string instance to be interned 
   * @return weak reference to interned string instance 
   */ 
  public static String weakIntern(String sample) {
    if (sample == null) {
      return null;