Java Code Examples for java.util.Map.Entry#equals()

The following examples show how to use java.util.Map.Entry#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultimapSubject.java    From FreeBuilder with Apache License 2.0 6 votes vote down vote up
@Override protected ContainmentAssertion<K, V> and(Entry<K, V> entry) {
  expected.add(entry);
  if (!entryIterator.hasNext()) {
    fail("contains", expected, "is missing", entry);
    return new FailedContainmentAssertion();
  }
  Entry<K, V> actualEntry = entryIterator.next();
  if (entry.equals(actualEntry)) {
    return this;
  }

  // The subject does not match the order specified by the user, but the entry may still be
  // present. Delegate to an OutOfOrderContainmentAssertion.
  Multimap<K, V> remaining = ArrayListMultimap.create();
  remaining.put(actualEntry.getKey(), actualEntry.getValue());
  while (entryIterator.hasNext()) {
    actualEntry = entryIterator.next();
    remaining.put(actualEntry.getKey(), actualEntry.getValue());
  }
  expected.remove(expected.size() - 1);
  return new OutOfOrderContainmentAssertion(expected, remaining).and(entry);
}
 
Example 2
Source File: WordClassCollection.java    From PolyGlot with MIT License 6 votes vote down vote up
private boolean propCombEqual(List<PEntry<Integer, Integer>> a, List<Entry<Integer, Integer>> b) {
    boolean ret = true;

    if (a.size() == b.size()) {
        for (Entry aEntry : a) {
            boolean aRet = false;

            for (Entry bEntry : b) {
                if (aEntry.equals(bEntry)) {
                    aRet = true;
                    break;
                }
            }

            ret = ret && aRet;
        }
    } else {
        ret = false;
    }

    return ret;
}
 
Example 3
Source File: ReaderRegistry.java    From kieker with Apache License 2.0 5 votes vote down vote up
/**
 * Reverse lookup of key based on value.
 *
 * @param value
 *            value
 * @return returns first key
 */
public Long getKey(final E value) {
	for (final Entry<Long, E> entry : this.registryEntries.entrySet()) {
		if (entry.equals(value)) {
			return entry.getKey();
		}
	}
	return null;
}
 
Example 4
Source File: InspectionResultMatcher.java    From angularjs-addon with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected boolean matchesSafely(List<Map<String, String>> allPropertyAttributes) {
    for (Map<String, String> singlePropertyAttributes : allPropertyAttributes) {
        for (Entry<String, String> propertyAttribute : singlePropertyAttributes.entrySet()) {
            if (propertyAttribute.equals(attributeEntry)) {
                return true;
            }
        }
    }
    return false;
}
 
Example 5
Source File: UniqueValueRepairer.java    From usergrid with Apache License 2.0 5 votes vote down vote up
private void startEntityScan() throws Exception, UnsupportedEncodingException {

		for (Entry<UUID, String> organizationName : getOrgs().entrySet()) {

			// Let's skip the test entities.
			if (organizationName.equals(properties.getProperty("usergrid.test-account.organization"))) {
				continue;
			}
			fetchApplicationsForOrgs(organizationName.getKey(), organizationName.getValue());
		}
	}
 
Example 6
Source File: Export.java    From usergrid with Apache License 2.0 3 votes vote down vote up
private void exportOrganizations() throws Exception, UnsupportedEncodingException {

		for (Entry<UUID, String> organizationName : getOrgs().entrySet()) {

			// Let's skip the test entities.
			if (organizationName.equals(properties.getProperty("usergrid.test-account.organization"))) {
				continue;
			}

			OrganizationInfo orgInfo = managementService.getOrganizationByUuid(organizationName.getKey());
			logger.info("Exporting Organization: " + orgInfo.getName());

			ExportOrg exportOrg = new ExportOrg(orgInfo);

			List<UserInfo> users = managementService.getAdminUsersForOrganization(organizationName.getKey());

			for (UserInfo user : users) {
				exportOrg.addAdmin(user.getUsername());
			}

			File orgDir = createOrgDir(orgInfo.getName());

			// One file per Organization.
			saveOrganizationMetadata(orgDir, exportOrg);

			exportApplicationsForOrg(orgDir, organizationName.getKey(), organizationName.getValue());
		}
	}