Package java.util

Examples of java.util.HashSet


  public static Collection getCollectionObj(Class<?> clazz) {
    if (clazz.isInterface()) {
      if (clazz.isAssignableFrom(List.class))
        return new ArrayList();
      else if (clazz.isAssignableFrom(Set.class))
        return new HashSet();
      else if (clazz.isAssignableFrom(Queue.class))
        return new ArrayDeque();
      else if (clazz.isAssignableFrom(SortedSet.class))
        return new TreeSet();
      else if (clazz.isAssignableFrom(BlockingQueue.class))
View Full Code Here


        if (_defaultDestination == null) {
            _defaultDestination = new PdfDestination(PdfDestination.FITH, height);
            _defaultDestination.addPage(_writer.getPageReference(1));
        }
       
        _linkTargetAreas = new HashSet();
    }
View Full Code Here

      if (Map.class.equals(actualClass)) {
        return new HashMap();
      } else if (List.class.equals(actualClass)) {
        return new ArrayList();
      } else if (Set.class.equals(actualClass)) {
        return new HashSet();
      }
      throw new IllegalStateException("Type not expected : " + actualClass);
    }
View Full Code Here

     */
    public void testCloneMethod2() throws Exception{
        CreateUpdateProcedureCommand s1 = sample1();
       
        //Command class state
        s1.addExternalGroupsToContext(new HashSet());
        s1.setIsResolved(true);
        s1.setOption(new Option());
        s1.setTemporaryMetadata(new HashMap());

        //CreateUpdateProcedure class state
View Full Code Here

    // Get invalid objects from report
    Collection actualObjs = new ArrayList();
    report.collectInvalidObjects(actualObjs);

    // Compare expected and actual objects
    Set<String> expectedStrings = new HashSet(Arrays.asList(expectedStringArray));
    Set<String> actualStrings = new HashSet<String>();
    Iterator objIter = actualObjs.iterator();
    while(objIter.hasNext()) {
        LanguageObject obj = (LanguageObject) objIter.next();
        actualStrings.add(SQLStringVisitor.getSQLString(obj));
    }

    if(expectedStrings.size() == 0 && actualStrings.size() > 0) {
        fail("Expected no failures but got some: " + report.getFailureMessage()); //$NON-NLS-1$
    } else if(actualStrings.size() == 0 && expectedStrings.size() > 0) {
        fail("Expected some failures but got none for sql = " + command); //$NON-NLS-1$
    } else {
        assertEquals("Expected and actual sets of strings are not the same: ", expectedStrings, actualStrings); //$NON-NLS-1$
    }
  }
View Full Code Here

      new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
    List docE3 = createElements(doc3, new String[] { "root", "root.node1.node2", "root.node2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
    List docE4 = createElements(doc4, new String[] { "root", "root.@node6", "root.node1", "root.node1.@node2", "root.node3", "root.node3.@node4", "root.node3.node4", "root.node3.root.node6" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
      new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
    Collection tempGroups = new HashSet();
    tempGroups.add(tm1g1);
    doc4.putProperty("TEMP_GROUPS", tempGroups); //$NON-NLS-1$
        List docE5 = createElements(doc5, new String[] { "root", "root.node1", "root.node1.node2" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            new String[] { DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING, DataTypeManager.DefaultDataTypes.STRING });
           
        // Create mapping classes for xmltest.doc5
View Full Code Here

public class ConfigurationResultImpl  {
 
   
  public static Collection mapProperties(ResourceDiscoveryContext discoveryContext, Properties values ) {
    Set<PropertySimple> properties = new HashSet();
    if (discoveryContext.getResourceType().getPluginConfigurationDefinition() == null) {
      return Collections.EMPTY_LIST;
    }
    Map<String , PropertyDefinition> propDefs = discoveryContext.getResourceType().getPluginConfigurationDefinition().getPropertyDefinitions();
   
    Iterator<String> propkeys = propDefs.keySet().iterator();
   
    while (propkeys.hasNext()) {
      final String key = propkeys.next();
      PropertyDefinition pdef = propDefs.get(key);
     
      if (pdef instanceof PropertyDefinitionSimple) {
        String fieldName = ((PropertyDefinitionSimple) pdef).getName();
        if (values.containsKey(fieldName)) {
       
          properties.add(new PropertySimple(key, values.get(fieldName)));
        }
      } else if (pdef instanceof PropertyDefinitionList) {
        PropertyDefinition propertyDefinitionMap = ((PropertyDefinitionList) pdef)
            .getMemberDefinition();
        Map simpleProperties = ((PropertyDefinitionMap) propertyDefinitionMap)
            .getPropertyDefinitions();
        Iterator simplePropertiesIter = simpleProperties.values()
            .iterator();
   
        while (simplePropertiesIter.hasNext()) {
          PropertyDefinition simpleProp = (PropertyDefinition) simplePropertiesIter
              .next();
          String fieldName = ((PropertyDefinitionSimple) simpleProp)
              .getName();
          if (values.contains(fieldName)) {
           
            properties.add(new PropertySimple(key, values.get(fieldName)));
          }
        }
   
      }
     
View Full Code Here

     */
    public static void mapExpressions(LanguageObject obj, Map exprMap) {
        if(obj == null || exprMap == null || exprMap.isEmpty()) {
            return;
        }
        final Set reverseSet = new HashSet(exprMap.values());
        final ExpressionMappingVisitor visitor = new ExpressionMappingVisitor(exprMap);
        PreOrderNavigator pon = new PreOrderNavigator(visitor) {
          @Override
          protected void visitNode(LanguageObject obj) {
            if (!(obj instanceof Expression) || !reverseSet.contains(obj)) {
                super.visitNode(obj);
            }
          }
        };
        obj.acceptVisitor(pon);
View Full Code Here

    }
  }

  @Test
  public void testIsSet() throws Exception {
    Object[] values = new Object[] { new TreeSet(), new HashSet(), new HashSet() };
    for (int i = 0; i < values.length; i++) {
      assertTrue(CollectionUtils.isSet(values[i].getClass()));
    }
  }
View Full Code Here

  }

  @Test
  public void testPut_Interface() {
    tracker.put("", "1");
    tracker.put("", new HashSet());
    assertEquals(new HashSet(), tracker.getMappedValue("", Set.class));
  }
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.