Java Code Examples for java.util.Map.Entry.getKey()

The following are Jave code examples for showing how to use getKey() of the java.util.Map.Entry class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.

+ Save this method
Example 1
Project: aws-toolkit-eclipse-master View Source Vote up 7 votes
public String toString() {
    String buffer = "";
    for (Entry<String, SchemaProperty> entry : properties.entrySet()) {
        buffer += " - " + entry.getKey() + ": " + entry.getValue() + "\n"; 
    }
    
    return buffer;
}
 
Example 2
Project: aws-toolkit-eclipse-master View Source Vote up 6 votes
private TemplateNode findNode(int documentOffset, TemplateNode node) {
    if (node.getStartLocation().getCharOffset() > documentOffset) {
        throw new RuntimeException("Out of bounds in node search");
    }

    if (node.isObject()) {
        TemplateObjectNode object = (TemplateObjectNode)node;
        for (Entry<String, TemplateNode> entry : object.getFields()) {
            entry.getKey();
            if (match(documentOffset, entry.getValue())) {
                return findNode(documentOffset, entry.getValue());
            }
        }
    } else if (node.isArray()) {
        TemplateArrayNode array = (TemplateArrayNode)node;
        for (TemplateNode member : array.getMembers()) {
            if (match(documentOffset, member)) {
                return findNode(documentOffset, member);
            }
        }
    }
    return node;
}
 
Example 3
Project: de.htwg.se.muehle-master View Source Vote up 6 votes
@Test
public void testGridIsEmpty(){

    for(Entry<Tuple, Cell> entry : this.matrix.entrySet()){
        Tuple key = entry.getKey();
        Cell value = entry.getValue();
        assertTrue(value.getCell() == TokenValues.EMPTY);
        
        
    }

}
 
Example 4
Project: virgo.kernel-master View Source Vote up 6 votes
/**
 * Merge the attributes of the source package import into those of the target package import. Throw
 * {@link ImportMergeException} if and only if there is a merge clash.
 * 
 * @param targetPackageImport the package import to be merged and updated
 * @param sourceImportToMerge the package import to be merged in
 * @throws ImportMergeException thrown if there is a merge clash
 */
private void mergeAttributes(ImportedPackage targetPackageImport, ImportedPackage sourceImportToMerge) throws ImportMergeException {
    Map<String, String> targetAttributes = targetPackageImport.getAttributes();
    Map<String, String> sourceAttributes = sourceImportToMerge.getAttributes();

    // Merge attributes before versions so, for example, conflicting bundle symbolic names take precedence over disjoint bundle version ranges.
    for (Entry<String, String> sourceAttributeEntry : sourceAttributes.entrySet()) {
        String sourceAttributeName = sourceAttributeEntry.getKey();
        if (!isVersionAttribute(sourceAttributeName)) {
            String sourceAttributeValue = sourceAttributeEntry.getValue();
            String targetAttributeValue = targetAttributes.get(sourceAttributeName);
            if (targetAttributeValue != null) {
                if (!targetAttributeValue.equals(sourceAttributeValue)) {
                    throw new ImportMergeException(targetPackageImport.getPackageName(), getPackageSources(targetPackageImport),
                        "conflicting values '" + sourceAttributeValue + "', '" + targetAttributeValue + "' of attribute '" + sourceAttributeName
                        + "'");
                }
            } else {
                targetAttributes.put(sourceAttributeName, sourceAttributeValue);
            }
        }
    }
    
    mergeVersionRanges(targetPackageImport, sourceImportToMerge);

    mergeBundleVersionRanges(targetPackageImport, sourceImportToMerge);
}
 
Example 5
Project: richfaces-master View Source Vote up 6 votes
@Test
public void testMouseOverSpecificTdElement() {
    /*
     * Move mouse over all td elements and check whether the showName is same as text of particular td element then move
     * mouse out of td element and check whether the output is empty
     */

    for (Entry<String, WebElement> entry : page.getNames().entrySet()) {
        String name = entry.getKey();
        WebElement element = entry.getValue();
        activate(element);
        Graphene.waitGui().until("The text in output should be same as in the active td!").element(page.getOutput()).text()
            .equalTo(name);
    }
}
 
Example 6
Project: richfaces-master View Source Vote up 6 votes
private String lookupIdMapping(String id, String newId) {

        // look for most recent mapping match or prefix-match
        String mapping = null;
        for (Entry<String, String> entry : idMapping.entrySet()) {
            final String referenceId = entry.getKey();
            final String mappedId = entry.getValue();

            if (id.equals(referenceId)) {
                return entry.getValue();
            }

            final String referenceIdPrefix = referenceId + ":";
            final String mappedIdPrefix = mappedId + ":";
            if (id.startsWith(referenceIdPrefix)) {
                mapping = id.replaceFirst("^" + referenceIdPrefix, mappedIdPrefix);
            }
        }

        if (mapping == null) {
            mapping = newId;
        }

        idMapping.put(id, newId);

        return mapping;
    }
 
Example 7
Project: phonegap-geolocation-master View Source Vote up 6 votes
/**
 * Creates a new instance from the given map of fields to values. If
 * present, the null field's last element will be used to set the status
 * line.
 */
public static RawHeaders fromMultimap(Map<String, List<String>> map, boolean response)
    throws IOException {
  if (!response) throw new UnsupportedOperationException();
  RawHeaders result = new RawHeaders();
  for (Entry<String, List<String>> entry : map.entrySet()) {
    String fieldName = entry.getKey();
    List<String> values = entry.getValue();
    if (fieldName != null) {
      for (String value : values) {
        result.addLenient(fieldName, value);
      }
    } else if (!values.isEmpty()) {
      result.setStatusLine(values.get(values.size() - 1));
    }
  }
  return result;
}
 
Example 8
Project: jena-master View Source Vote up 6 votes
String xmlnsDecl() {
	workOutNamespaces();
	StringBuilder result = new StringBuilder();
	Iterator<Entry<String, String>> it = ns.entrySet().iterator();
	while (it.hasNext()) {
		Entry<String, String> ent = it.next();
		String prefix = ent.getValue();
		String uri = ent.getKey();
           result.append( newline ).append( "    xmlns" );
		if (prefix.length() > 0) result.append( ':' ).append( prefix );
		result.append( '=' ).append( substitutedAttribute( checkURI( uri ) ) );
	}
	return result.toString();
}
 
Example 9
Project: jena-master View Source Vote up 6 votes
protected void processModel(Model model)
{
    prefixMap = model.getNsPrefixMap() ;
    bNodesMap = new HashMap<>() ;

    for ( Iterator<Entry<String, String>> iter = prefixMap.entrySet().iterator() ; iter.hasNext() ; )
    {
        Entry<String, String> e = iter.next() ;
        String prefix = e.getKey() ;
        String uri = e.getValue(); 
        
        // XML namespaces name can include '.'
        // Turtle prefixed names can't.
        if ( ! checkPrefixPart(prefix) ) 
            iter.remove() ;
        else
        {
            if ( checkPrefixPart(prefix) )
                // Build acceptable reverse mapping  
                reversePrefixMap.put(uri, prefix) ;
        }
    }
    
    startWriting() ;
    prepare(model) ;

    writeHeader(model) ;
    writePrefixes(model) ;
    
    if (prefixMap.size() != 0)
        out.println();

    // Do the output.
    writeModel(model) ;

    // Release intermediate memory - allows reuse of a writer
    finishWriting() ;
    bNodesMap = null ;
}