java.util.Hashtable.contains()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(186)

本文整理了Java中java.util.Hashtable.contains()方法的一些代码示例,展示了Hashtable.contains()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hashtable.contains()方法的具体详情如下:
包路径:java.util.Hashtable
类名称:Hashtable
方法名:contains

Hashtable.contains介绍

[英]Returns true if this Hashtable contains the specified object as the value of at least one of the key/value pairs.
[中]如果此哈希表包含指定的对象作为至少一个键/值对的值,则返回true。

代码示例

代码示例来源:origin: spotbugs/spotbugs

public void hashtablesCantContainNull(Hashtable h) {
    h.put("a", null);
    h.put(null, "a");
    h.get(null);
    h.contains(null);
    h.containsKey(null);
    h.containsValue(null);
    h.remove(null);

  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Check if the table contains a particular value.
 * @param value the value to look for.
 * @return true if the table contains the value.
 */
public boolean contains(Object value) {
  initAll();
  return super.contains(value);
}

代码示例来源:origin: Sable/soot

if (toBeRemoved.contains(predPDGofdepB)) {
 blocks2BRemoved = toBeRemoved.get(predPDGofdepB);
} else {

代码示例来源:origin: org.apache.geronimo.plugins/plancreator-portlets

public void readSecurityData(PortletRequest request) {
  String moduleName = "";
  if (webModules.containsKey(moduleName)) {
    WARConfigData warConfig = webModules.get(moduleName);
    warConfig.readSecurityData(request);
  } else if (ejbModules.contains(moduleName)) {
    EjbConfigData ejbConfig = ejbModules.get(moduleName);
    ejbConfig.readSecurityData(request);
  } else {
    System.out.println("Invaild module name: " + moduleName + " !!");
  }
}

代码示例来源:origin: apache/groovy

public synchronized boolean contains(Object value) {
  return project.getProperties().contains(value);
}

代码示例来源:origin: spotbugs/spotbugs

@NoWarning("GC_UNRELATED_TYPES")
public boolean testContainsHashtable(Integer i) {
  return hashtable.contains(i);
}

代码示例来源:origin: spotbugs/spotbugs

@ExpectWarning("GC_UNRELATED_TYPES")
public boolean testContainsHashtable(String s) {
  return hashtable.contains(s);
}

代码示例来源:origin: xalan/xalan

(_prefixMapping.contains(uri))) {
Enumeration prefixes = _prefixMapping.keys();
while (prefixes.hasMoreElements()) {

代码示例来源:origin: googlemaps/android-maps-utils

/**
 * Takes the input from the user and generates the required heatmap.
 * Called when a search query is submitted
 */
public void submit(View view) {
  if ("YOUR_KEY_HERE".equals(API_KEY)) {
    Toast.makeText(this, "Please sign up for a Places API key and add it to HeatmapsPlacesDemoActivity.API_KEY",
      Toast.LENGTH_LONG).show();
    return;
  }
  EditText editText = (EditText) findViewById(R.id.input_text);
  String keyword = editText.getText().toString();
  if (mOverlays.contains(keyword)) {
    Toast.makeText(this, "This keyword has already been inputted :(", Toast.LENGTH_SHORT).show();
  } else if (mOverlaysRendered == MAX_CHECKBOXES) {
    Toast.makeText(this, "You can only input " + MAX_CHECKBOXES + " keywords. :(", Toast.LENGTH_SHORT).show();
  } else if (keyword.length() != 0) {
    mOverlaysInput++;
    ProgressBar progressBar = (ProgressBar) findViewById(R.id.progress_bar);
    progressBar.setVisibility(View.VISIBLE);
    new MakeOverlayTask().execute(keyword);
    editText.setText("");
    InputMethodManager imm = (InputMethodManager) getSystemService(
        Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(editText.getWindowToken(), 0);
  }
}

代码示例来源:origin: org.codehaus.plexus/plexus-archiver

public Stack<String> asStringStack( String entry )
{
  Stack<String> directories = new Stack<String>();
  // Don't include the last entry itself if it's
  // a dir; it will be added on its own.
  int slashPos = entry.length() - ( entry.endsWith( "/" ) ? 1 : 0 );
  while ( ( slashPos = entry.lastIndexOf( '/', slashPos - 1 ) ) != -1 )
  {
    String dir = entry.substring( 0, slashPos + 1 );
    if ( addedDirs.contains( dir ) )
    {
      break;
    }
    directories.push( dir );
  }
  return directories;
}

代码示例来源:origin: stackoverflow.com

while (locales.hasMoreElements()) {
  Locale locale = (Locale) locales.nextElement();
  if (supportedLanguages.contains(locale)) {
    requestLocale = locale;
    break;

代码示例来源:origin: org.codehaus.castor/castor-xml-schema

/**
 * Returns true if the given {@link Schema} has been marked as processed
 * 
 * @param schema the {@link Schema} to check for being marked as processed
 * @return true if the given {@link Schema} has been marked as processed
 */
boolean processed(Schema schema) {
 return _processed.contains(schema);
}

代码示例来源:origin: hyperion-project/hypercon

public String getValue(String pKey, String pDefault) {
  if (!mDeviceConfig.mDeviceProperties.contains(pKey)) {
    return pDefault;
  }
  return mDeviceConfig.mDeviceProperties.get(pKey).toString();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-antlr

protected void genASTDeclaration(AlternativeElement el, String var_name, String node_type) {
  // already declared?
  if (declaredASTVariables.contains(el))
    return;
  // emit code
  println(node_type + " " + var_name + "_AST = null;");
  // mark as declared
  declaredASTVariables.put(el,el);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * @see java.util.Hashtable#contains(java.lang.Object)
 */
@Override
public synchronized boolean contains(Object value) {
  return this.getDelegate().contains(value);
}

代码示例来源:origin: org.glassfish.external/antlr

protected void genASTDeclaration(AlternativeElement el, String var_name, String node_type)
{
  // already declared?
  if (declaredASTVariables.contains(el))
    return;
  // emit code
  //String s = StringUtils.stripFrontBack(node_type, "\"", "\"");
  //println(s + " " + var_name + "_AST = null;");
  println(node_type + " " + var_name + "_AST = null;");
  // mark as declared
  declaredASTVariables.put(el,el);
}

代码示例来源:origin: com.xmlcalabash/xmlcalabash

public void addStep(DeclareStep step) {
  QName type = step.getDeclaredType();
  if (type == null) {
    // It can't be called so it doesn't really matter...
    return;
  }
  if (declaredSteps.contains(type)) {
    throw new XProcException(step.getNode(), "You aren't allowed to do this");
  }
  steps.add(step);
  declaredSteps.put(type, step);
}

代码示例来源:origin: org.daisy.libs/com.xmlcalabash

public void addStep(DeclareStep step) {
  QName type = step.getDeclaredType();
  if (type == null) {
    // It can't be called so it doesn't really matter...
    return;
  }
  if (declaredSteps.contains(type)) {
    throw new XProcException(step.getNode(), "You aren't allowed to do this");
  }
  steps.add(step);
  declaredSteps.put(type, step);
}

代码示例来源:origin: org.nakedobjects/nof-core

public NakedCollection getAdapterForElseCreateAdapterForCollection(
    final NakedObject parent,
    final String fieldName,
    final NakedObjectSpecification elementSpecification,
    final Object collection) {
  if (collectionAdapters.contains(collection)) {
    return (NakedCollection) collectionAdapters.get(collection);
  } else {
    return createAdapterForCollection(collection, elementSpecification);
  }
}

代码示例来源:origin: toplink.essentials/toplink-essentials

/**
 * INTERNAL:
 * This method is used to determine if the clone is a new Object in the UnitOfWork
 */
public boolean isObjectNew(Object clone) {
  //CR3678 - ported from 4.0
  return (isCloneNewObject(clone) || (!isObjectRegistered(clone) && !getReadOnlyClasses().contains(clone.getClass()) && !getUnregisteredExistingObjects().contains(clone)));
}

相关文章