Tabnine Logo
String.intern
Code IndexAdd Tabnine to your IDE (free)

How to use
intern
method
in
java.lang.String

Best Java code snippets using java.lang.String.intern (Showing top 20 results out of 10,854)

origin: stackoverflow.com

 String str=readString(); // read lengthy string any source db,textbox/jsp etc..
// This will place the string in memory pool from which you cant remove
str.intern();
origin: stanfordnlp/CoreNLP

private String intern(String s) {
 if (flags.intern) {
  return s.intern();
 } else {
  return s;
 }
}
origin: stanfordnlp/CoreNLP

private String intern(String s) {
 if (flags.intern) {
  return s.intern();
 } else {
  return s;
 }
}
origin: stanfordnlp/CoreNLP

public ExtractionObject(String objectId, 
  CoreMap sentence,
  Span span,
  String type,
  String subtype) {
 this.objectId = objectId;
 this.sentence = sentence;
 this.extentTokenSpan = span;
 this.type = type.intern();
 this.subType = (subtype != null ? subtype.intern() : null);
 this.attributeMap = null;
}
origin: stanfordnlp/CoreNLP

private String intern(String s) {
 if (globalFlags.intern) {
  return s.intern();
 }
 return s;
}
origin: stanfordnlp/CoreNLP

private void internStrings() {
 if (first != null) {
  first = first.intern();
 }
 if (second != null) {
  second = second.intern();
 }
}
origin: iBotPeaches/Apktool

private void checkInterning(String name) {
  if (namesInterned && name != name.intern()) {
    throw new IllegalArgumentException(
        "all names passed as arguments must be interned"
            + "when NAMES INTERNED feature is enabled");
  }
}
origin: jenkinsci/jenkins

/**
 * Null-safe String intern method.
 * @return A canonical representation for the string object. Null for null input strings
 */
@Nullable
public static String intern(@CheckForNull String s) {
  return s==null ? s : s.intern();
}
origin: Netflix/zuul

public HeaderName(String name)
{
  if (name == null) throw new NullPointerException("HeaderName cannot be null!");
  this.name = SHOULD_INTERN ? name.intern() : name;
  this.normalised = SHOULD_INTERN ? name.toLowerCase().intern() : name.toLowerCase();
}
origin: prestodb/presto

private static void addNumerals(TreeMap<String, Integer> map, int start, int end, Integer[] integers) {
  for (int i=start; i<=end; i++) {
    map.put(String.valueOf(i).intern(), integers[i]);
  }
}
origin: stanfordnlp/CoreNLP

private void addAllInterningAndPrefixing(Collection<String> accumulator, Collection<String> addend, String prefix) {
 assert prefix != null;
 for (String protoFeat : addend) {
  if ( ! prefix.isEmpty()) {
   protoFeat = prefix + protoFeat;
  }
  if (globalFlags.intern) {
   protoFeat = protoFeat.intern();
  }
  accumulator.add(protoFeat);
 }
}
origin: jenkinsci/jenkins

/** Share data structure with other builds, mainly those of the same job. */
private PackedMap<String,String> compact(Map<String,String> record) {
  Map<String,String> b = new HashMap<String,String>();
  for (Entry<String,String> e : record.entrySet()) {
    b.put(e.getKey().intern(), e.getValue().intern());
  }
  return PackedMap.of(b);
}
origin: stanfordnlp/CoreNLP

/**
 * Normalizes a nonterminal contents.
 * This implementation strips functional tags, etc. and interns the
 * nonterminal.
 */
@Override
public String normalizeNonterminal(String category) {
 return cleanUpLabel(category).intern();
}
origin: stanfordnlp/CoreNLP

/**
 * Normalizes a nonterminal contents.
 * This implementation strips functional tags, etc. and interns the
 * nonterminal.
 */
@Override
public String normalizeNonterminal(String category) {
 return cleanUpLabel(category).intern();
}
origin: alibaba/canal

protected String getFullName(String schemaName, String tableName) {
  StringBuilder sb = new StringBuilder();
  if (schemaName != null) {
    sb.append(appendEscape(schemaName)).append(DOT);
  }
  sb.append(appendEscape(tableName));
  return sb.toString().intern();
}
origin: alibaba/canal

public String getSelectSql(String schemaName, String tableName, String[] pkNames, String[] columnNames) {
  StringBuilder sql = new StringBuilder("select ");
  int size = columnNames.length;
  for (int i = 0; i < size; i++) {
    sql.append(appendEscape(columnNames[i])).append((i + 1 < size) ? " , " : "");
  }
  sql.append(" from ").append(getFullName(schemaName, tableName)).append(" where ( ");
  appendColumnEquals(sql, pkNames, "and");
  sql.append(" ) ");
  return sql.toString().intern();// 不使用intern,避免方法区内存消耗过多
}
origin: alibaba/canal

public String getDeleteSql(String schemaName, String tableName, String[] pkNames) {
  StringBuilder sql = new StringBuilder("delete from " + getFullName(schemaName, tableName) + " where ");
  appendColumnEquals(sql, pkNames, "and");
  return sql.toString().intern();// intern优化,避免出现大量相同的字符串
}
origin: stanfordnlp/CoreNLP

/**
 * Removes duplicate graphs from the set, using the string form of the graph
 * as the key (obviating issues with object equality).
 */
public static Collection<SemanticGraph> removeDuplicates(Collection<SemanticGraph> graphs) {
 Map<String, SemanticGraph> map = Generics.newHashMap();
 for (SemanticGraph sg : graphs) {
  String keyVal = sg.toString().intern();
  map.put(keyVal, sg);
 }
 return map.values();
}
origin: alibaba/canal

public String getUpdateSql(String schemaName, String tableName, String[] pkNames, String[] columnNames) {
  StringBuilder sql = new StringBuilder("update " + getFullName(schemaName, tableName) + " set ");
  appendColumnEquals(sql, columnNames, ",");
  sql.append(" where (");
  appendColumnEquals(sql, pkNames, "and");
  sql.append(")");
  return sql.toString().intern(); // 不使用intern,避免方法区内存消耗过多
}
origin: Netflix/zuul

public HeaderName(String name)
{
  if (name == null) throw new NullPointerException("HeaderName cannot be null!");
  this.name = SHOULD_INTERN ? name.intern() : name;
  this.normalised = SHOULD_INTERN ? name.toLowerCase().intern() : name.toLowerCase();
}
java.langStringintern

Javadoc

Returns a canonical representation for the string object.

A pool of strings, initially empty, is maintained privately by the class String.

When the intern method is invoked, if the pool already contains a string equal to this String object as determined by the #equals(Object) method, then the string from the pool is returned. Otherwise, this String object is added to the pool and a reference to this String object is returned.

It follows that for any two strings s and t, s.intern() == t.intern() is true if and only if s.equals(t) is true.

All literal strings and string-valued constant expressions are interned. String literals are defined in section 3.10.5 of the The Java™ Language Specification.

Popular methods of String

  • equals
  • length
    Returns the number of characters in this string.
  • substring
    Returns a string containing a subsequence of characters from this string. The returned string shares
  • startsWith
    Compares the specified string to this string, starting at the specified offset, to determine if the
  • format
    Returns a formatted string, using the supplied format and arguments, localized to the given locale.
  • split
    Splits this string using the supplied regularExpression. See Pattern#split(CharSequence,int) for an
  • trim
  • valueOf
    Creates a new string containing the specified characters in the character array. Modifying the chara
  • indexOf
  • endsWith
    Compares the specified string to this string to determine if the specified string is a suffix.
  • toLowerCase
    Converts this string to lower case, using the rules of locale.Most case mappings are unaffected by t
  • contains
    Determines if this String contains the sequence of characters in the CharSequence passed.
  • toLowerCase,
  • contains,
  • getBytes,
  • <init>,
  • equalsIgnoreCase,
  • replace,
  • isEmpty,
  • charAt,
  • hashCode,
  • lastIndexOf

Popular in Java

  • Making http requests using okhttp
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • Socket (java.net)
    Provides a client-side TCP socket.
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now