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

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

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

Hashtable.keySet介绍

[英]Each of these fields are initialized to contain an instance of the appropriate view the first time this view is requested. The views are stateless, so there's no reason to create more than one of each.
[中]在第一次请求此视图时,这些字段中的每个字段都会初始化为包含相应视图的实例。视图是无状态的,因此没有理由创建多个视图。

代码示例

代码示例来源:origin: spring-projects/spring-framework

return new SimpleNamingContext(this.root, this.boundObjects, this.environment);
Object found = this.boundObjects.get(name);
if (found == null) {
  if (!name.endsWith("/")) {
    name = name + "/";
  for (String boundName : this.boundObjects.keySet()) {
    if (boundName.startsWith(name)) {
      return new SimpleNamingContext(name, this.boundObjects, this.environment);
      StringUtils.collectionToDelimitedString(this.boundObjects.keySet(), ",") + "]");

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

public void addAll(WeightedDirectedSparseGraph othergraph) {
 WeightedDirectedSparseGraph another = othergraph;
 this.isUnknown = another.isUnknown;
 this.clear();
 Hashtable<Object, Hashtable<Object, IntContainer>> othersources = another.sources;
 Iterator<Object> othersrcIt = othersources.keySet().iterator();
 while (othersrcIt.hasNext()) {
  Object src = othersrcIt.next();
  Hashtable othertargets = othersources.get(src);
  Hashtable<Object, IntContainer> thistargets = new Hashtable<Object, IntContainer>(othersources.size());
  this.sources.put(src, thistargets);
  Iterator targetIt = othertargets.keySet().iterator();
  while (targetIt.hasNext()) {
   Object target = targetIt.next();
   IntContainer otherweight = (IntContainer) othertargets.get(target);
   thistargets.put(target, otherweight.dup());
  }
 }
}

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

/**
 * Add all available classes, that depend on Remote, Home, Bean, PK
 * @param checkEntries files, that are extracted from the deployment descriptor
 * @throws BuildException if there is a problem.
 */
protected void checkAndAddDependants(Hashtable<String, File> checkEntries)
  throws BuildException {
  if (dependencyAnalyzer == null) {
    return;
  }
  dependencyAnalyzer.reset();
  for (String entryName : checkEntries.keySet()) {
    if (entryName.endsWith(".class")) {
      String className = entryName.substring(0,
        entryName.length() - ".class".length());
      className = className.replace(File.separatorChar, '/');
      className = className.replace('/', '.');
      dependencyAnalyzer.addRootClass(className);
    }
  }
  for (String classname : Collections.list(dependencyAnalyzer.getClassDependencies())) {
    String location = classname.replace('.', File.separatorChar) + ".class";
    File classFile = new File(config.srcDir, location);
    if (classFile.exists()) {
      checkEntries.put(location, classFile);
      log("dependent class: " + classname + " - " + classFile,
        Project.MSG_VERBOSE);
    }
  }
}

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

public void addBoundedAll(WeightedDirectedSparseGraph another) {
 this.isUnknown = another.isUnknown;
 Hashtable<Object, Hashtable<Object, IntContainer>> othersources = another.sources;
 Iterator thisnodeIt = this.vertexes.iterator();
 while (thisnodeIt.hasNext()) {
  Object src = thisnodeIt.next();
  Hashtable othertargets = othersources.get(src);
  if (othertargets == null) {
   continue;
  }
  Hashtable<Object, IntContainer> thistargets = new Hashtable<Object, IntContainer>();
  Iterator othertargetIt = othertargets.keySet().iterator();
  while (othertargetIt.hasNext()) {
   Object key = othertargetIt.next();
   if (this.vertexes.contains(key)) {
    IntContainer weight = (IntContainer) othertargets.get(key);
    thistargets.put(key, weight.dup());
   }
  }
  if (thistargets.size() > 0) {
   this.sources.put(src, thistargets);
  }
 }
}

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

public String toString() {
 String graphstring = "WeightedDirectedSparseGraph:\n";
 graphstring = graphstring + this.vertexes + "\n";
 Iterator<Object> srcIt = sources.keySet().iterator();
 while (srcIt.hasNext()) {
  Object src = srcIt.next();
  graphstring = graphstring + src + " : ";
  Hashtable targets = sources.get(src);
  Iterator targetIt = targets.keySet().iterator();
  while (targetIt.hasNext()) {
   Object target = targetIt.next();
   IntContainer weight = (IntContainer) targets.get(target);
   graphstring = graphstring + target + "(" + weight.value + ")  ";
  }
  graphstring += "\n";
 }
 return graphstring;
}

代码示例来源:origin: crashub/crash

Completion.Builder b = new Completion.Builder(keyValue[0]);
 for (ObjectName name : completions) {
  for (String key : name.getKeyPropertyList().keySet()) {
   if (!keyValues.containsKey(key) && key.startsWith(keyValue[0])) {
    b.add(key.substring(keyValue[0].length()) + "=", false);
   Hashtable<String, String> a = completion.getKeyPropertyList();
   a.remove(keyValue[0]);
   a.keySet().removeAll(keyValues.keySet());
   if (a.isEmpty()) {
    b.add(value.substring(keyValue[1].length()), true);
keyValues.put(keyValue[0], keyValue[1]);
prev = next + 1;

代码示例来源:origin: pentaho/pentaho-kettle

files.put( filename, properties );
locales = new Hashtable<String, Boolean>( 10 );
for ( String filename : files.keySet() ) {
 String path = getPath( filename );
 Integer num = directories.get( path );
 if ( num != null ) {
  num = Integer.valueOf( num.intValue() + 1 );
  num = Integer.valueOf( 1 );
 directories.put( path, num );
 locales.put( locale, Boolean.TRUE );

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

public void updateWeight(Object which, int c) {
 /* for the in edge, the weight + c. for the out edge, the weight - c */
 Iterator<Object> srcIt = sources.keySet().iterator();
 while (srcIt.hasNext()) {
  Object from = srcIt.next();
  Hashtable targets = sources.get(from);
  IntContainer weight = (IntContainer) targets.get(which);
  if (weight != null) {
   weight.value += c;
  }
 }
 /* update out edges */
 Hashtable toset = sources.get(which);
 if (toset == null) {
  return;
 }
 Iterator toIt = toset.keySet().iterator();
 while (toIt.hasNext()) {
  Object to = toIt.next();
  IntContainer weight = (IntContainer) toset.get(to);
  weight.value -= c;
 }
}

代码示例来源:origin: dCache/dcache

void mergeHorizontal( UserPrivileges right ){
  String attr;
  for (Object o : right._denied.keySet()) {
    _denied.put(attr = (String) o, attr);
  }
  for (Object o : right._allowed.keySet()) {
    _allowed.put(attr = (String) o, attr);
    _denied.remove(attr);
  }
}
void mergeVertical( UserPrivileges upper ){

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

private boolean SSSPFinder(Object src) {
 Hashtable<Object, IntContainer> outedges = sources.get(src);
 if (outedges == null) {
  return true;
   WeightedDirectedEdge edge = edgeIt.next();
   IntContainer dfrom = distance.get(edge.from);
   IntContainer dto = distance.get(edge.to);
   if (dto == null) {
    continue;
 Iterator<Object> targetIt = distance.keySet().iterator();
 while (targetIt.hasNext()) {
  Object to = targetIt.next();
  IntContainer dist = distance.get(to);
  outedges.put(to, dist.dup());

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

private void getReachableNodesAndEdges(Object src) {
 LinkedList<Object> worklist = new LinkedList<Object>();
 reachableNodes.add(src);
 worklist.add(src);
 while (!worklist.isEmpty()) {
  Object from = worklist.removeFirst();
  Hashtable targets = sources.get(from);
  if (targets == null) {
   continue;
  }
  Iterator targetIt = targets.keySet().iterator();
  while (targetIt.hasNext()) {
   Object target = targetIt.next();
   if (!reachableNodes.contains(target)) {
    worklist.add(target);
    reachableNodes.add(target);
   }
   IntContainer weight = (IntContainer) targets.get(target);
   reachableEdges.add(new WeightedDirectedEdge(from, target, weight.value));
  }
 }
}

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

Ramdom r = new Random();
 Hashtable<Integer, Integer> h = new Hashtable<Integer, Integer>();
 while( h.keys().size() < 5 ) {
     int i = r.nextInt(10);
     h.put(i,i);
 }
 Integer[] k = (Integer[]) h.keySet().toArray();

代码示例来源:origin: aws/aws-sdk-java

addressTable.put(a, Message.RecipientType.TO);
    addressTable.put(a, Message.RecipientType.TO);
    addressTable.put(a, Message.RecipientType.CC);
m.setRecipients(Message.RecipientType.BCC, new Address[0]);
Iterator<Address> aIter = addressTable.keySet().iterator();
  m.addRecipient(addressTable.get(a), a);
  m.setRecipient(Message.RecipientType.TO, addressTable.keySet().iterator().next());

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

public void killNode(Object tokill) {
 if (!this.vertexes.contains(tokill)) {
  return;
 }
 this.makeShortestPathGraph();
 List<Object> sourceList = new ArrayList<Object>(sources.keySet());
 Iterator<Object> srcIt = sourceList.iterator();
 while (srcIt.hasNext()) {
  Object src = srcIt.next();
  Hashtable targets = sources.get(src);
  /* delete the in edge */
  targets.remove(tokill);
  if (targets.size() == 0) {
   sources.remove(src);
  }
 }
 sources.remove(tokill);
 this.makeShortestPathGraph();
}

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

ArrayList<String> test = new ArrayList<String>();
Hashtable <ArrayList<String>, Integer> h1 = new Hashtable <ArrayList<String>, Integer>();
Hashtable <ArrayList<String>, Integer> h2 = new Hashtable <ArrayList<String>, Integer>();
for (ArrayList<String> key : h2.keySet()) {
  if(h1.containsKey(key))
    h2.put(key, 1);
}

代码示例来源:origin: pentaho/pentaho-kettle

for ( String filename : files.keySet() ) {
 if ( getPath( filename ).equals( dir ) ) { // yep, add this one
  Properties properties = files.get( filename );
  ArrayList<Object> entryObjects = new ArrayList<Object>( properties.keySet() );
  ArrayList<String> entries = new ArrayList<String>();
    } else {
     String javaFile = dir + "/" + classname + ".java";
     fileContent = javaFiles.get( javaFile );
     if ( fileContent == null ) {
      fileContent = loadJava( javaFile, filename, entry );
      javaFiles.put( javaFile, fileContent );
   boolean localeSelected = ( locales.get( locale ) ).booleanValue();

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

List<Object> sourceList = new ArrayList<Object>(this.sources.keySet());
 Hashtable thistargets = this.sources.get(src);
 Hashtable othertargets = othersources.get(src);
 List targetList = new ArrayList(thistargets.keySet());
  IntContainer thisweight = (IntContainer) thistargets.get(target);
  IntContainer otherweight = (IntContainer) othertargets.get(target);

代码示例来源:origin: org.apache.ctakes/ctakes-utils

/**
 * Clones this object, its attributes, and reference keys.
 * @return A shallow copy of this object.
 */
public final XcasAnnotation shallowCopy () {
  XcasAnnotation o = prepareCopy();
  for (String s : references.keySet())
    o.references.put(s, new MyVector());
  return o;
}

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

@Override
public List<UserVmJoinVO> newUserVmView(UserVm... userVms) {
  Hashtable<Long, UserVm> userVmDataHash = new Hashtable<Long, UserVm>();
  for (UserVm vm : userVms) {
    if (!userVmDataHash.containsKey(vm.getId())) {
      userVmDataHash.put(vm.getId(), vm);
    }
  }
  Set<Long> vmIdSet = userVmDataHash.keySet();
  List<UserVmJoinVO> uvms = searchByIds(vmIdSet.toArray(new Long[vmIdSet.size()]));
  // populate transit password field from UserVm
  if (uvms != null) {
    for (UserVmJoinVO uvm : uvms) {
      UserVm v = userVmDataHash.get(uvm.getId());
      uvm.setPassword(v.getPassword());
    }
  }
  return uvms;
}

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

Iterator<Object> sourceIt = this.sources.keySet().iterator();
while (sourceIt.hasNext()) {
 Object src = sourceIt.next();
 Hashtable thistarget = sources.get(src);
 Hashtable othertarget = othersources.get(src);
 Iterator targetIt = thistarget.keySet().iterator();
 while (targetIt.hasNext()) {
  Object target = targetIt.next();
  IntContainer thisweight = (IntContainer) thistarget.get(target);
  IntContainer otherweight = (IntContainer) othertarget.get(target);

相关文章