Package java.util

Examples of java.util.HashSet


    return (V)child.put(key, value);
  }
 
  @Override
  public Set<K> keys() {
    HashSet keys = new HashSet();
    Node<K, V> node = getRootNode();
    Set<Node<K, V>> children = node.getChildren();
    for (Node<K, V> child:children) {
      for (K key:child.getData().keySet()) {
        if ((key instanceof String) && (key.equals(ExpirationAlgorithmConfig.EXPIRATION_KEY))) {
          continue;
        }
        keys.add(key);
      }
    }
    return keys;
 
View Full Code Here


    public TestCollectorVisitor(String name) {
        super(name);
    }

    public Set getStringSet(Collection objs) {
        Set strings = new HashSet();
       
        Iterator iter = objs.iterator();
        while(iter.hasNext()) {
            Object obj = iter.next();
            if(obj == null) {
                strings.add(null);
            } else {
                strings.add(obj.toString());
            }
        }
       
        return strings;
    }
View Full Code Here

        return strings;
    }
   
    public void helpTestCollection(LanguageObject obj, Class type, String[] objects) {
        Set actualObjects = getStringSet(CollectorVisitor.collectObjects(type, obj));
        Set expectedObjects = new HashSet(Arrays.asList(objects));
       
        assertEquals("Did not get expected objects", expectedObjects, actualObjects); //$NON-NLS-1$
    }
View Full Code Here

    public void helpTestElementsUsedByGroups(LanguageObject obj, String[] elements, String[] groups) {
        Set actualElements = getStringSet(CollectorVisitor.collectElements(obj));
        Set actualGroups = getStringSet(CollectorVisitor.collectGroupsUsedByElements(obj));
       
        Set expectedElements = new HashSet(Arrays.asList(elements));
        Set expectedGroups = new HashSet(Arrays.asList(groups));
       
        assertEquals("Did not get expected elements", expectedElements, actualElements); //$NON-NLS-1$
        assertEquals("Did not get expected groups", expectedGroups, actualGroups);         //$NON-NLS-1$
    }
View Full Code Here

      ServiceRegistration registration = (ServiceRegistration) registeredServices.get(objName);
      registration.setProperties(registrationProperties);
      return;
    }
   
    Set serviceNames = new HashSet();
    computeOSGiServiceNames(obj.getClass(), obj, serviceNames);
    ServiceRegistration registration = Activator.context.registerService((String[]) serviceNames.toArray(new String[serviceNames.size()]), obj, registrationProperties);
    registeredServices.put(objName, registration);
  }
View Full Code Here

  public Set queryNames(String objectName) throws MalformedObjectNameException {
    if (mxserver == null) {
      return null;
    }
    Set objectNames = mxserver.queryNames(new ObjectName(objectName), null);
    Set names = new HashSet();
    for (Iterator iterator = objectNames.iterator(); iterator.hasNext();) {
      ObjectName objName = (ObjectName) iterator.next();
      names.add(objName.getCanonicalName());
    }
    return names;
  }
View Full Code Here

     * Obtain list of connectors that failed. 
     * @return List of connectors that failed - List contains String names
     */
    public Collection getFailedConnectors() {
        if(this.failures != null) {
            return new HashSet(this.failures.keySet());
        }
        return Collections.EMPTY_SET;
    }
View Full Code Here

   * defaults of the properties, the third Map the defaults of the second Map, and so on...
   * @return true all keys are present, false otherwise
   */
    private static final boolean verifyAllPropsPresent(Properties props, List chainOfMappings){
      Enumeration e = props.propertyNames();
    HashSet propNames = new HashSet();
      while (e.hasMoreElements()) {
            propNames.add( e.nextElement());
      }
     
      HashSet testNames = new HashSet();
        Iterator i = chainOfMappings.iterator();
        while (i.hasNext()) {
            Map aMapping = (Map) i.next();
      testNames.addAll(aMapping.keySet());
        }     
    return propNames.containsAll(testNames);
  }
View Full Code Here

      new Listener()
      {
        public void
        handleEvent(Event event)
        {
          java.util.Set  types = new HashSet();
         
          types.add( AzureusCoreStats.ST_ALL );
         
          Map  reply = AzureusCoreStats.getStats( types );
         
          Iterator  it = reply.entrySet().iterator();
         
View Full Code Here

   * of the subcommands that this object owns
   * @return
   */
  public Iterator iterator()
  {
    return new HashSet(subCommands.values()).iterator();
  }
View Full Code Here

TOP

Related Classes of java.util.HashSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.