All Downloads are FREE. Search and download functionalities are using the official Maven repository.

overflowdb.util.StringInterner Maven / Gradle / Ivy

There is a newer version: 1.173
Show newest version
package overflowdb.util;

import java.util.concurrent.ConcurrentHashMap;

public class StringInterner {
  private static ConcurrentHashMap internedStrings = new ConcurrentHashMap<>();

  public static String intern(String s){
    String interned = internedStrings.putIfAbsent(s, s);
    return interned == null ? s : interned;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy