当前位置: 首页>>代码示例>>Java>>正文


Java Set.equals方法代码示例

本文整理汇总了Java中java.util.Set.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Set.equals方法的具体用法?Java Set.equals怎么用?Java Set.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.Set的用法示例。


在下文中一共展示了Set.equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getUuidForLocalClassLoaders

import java.util.Set; //导入方法依赖的package包/类
private UUID getUuidForLocalClassLoaders(Set<ClassLoader> candidates) {
    for (LocalClassLoaderMapping localClassLoaderMapping : new ArrayList<LocalClassLoaderMapping>(classLoaders.values())) {
        Set<ClassLoader> localCandidates = new LinkedHashSet<ClassLoader>();
        for (WeakReference<ClassLoader> reference : localClassLoaderMapping.classLoaders) {
            ClassLoader cl = reference.get();
            if (cl != null) {
                localCandidates.add(cl);
            }
        }
        if (localCandidates.isEmpty()) {
            classLoaders.remove(localClassLoaderMapping.uuid);
            continue;
        }
        if (localCandidates.equals(candidates)) {
            return localClassLoaderMapping.uuid;
        }
    }

    LocalClassLoaderMapping details = new LocalClassLoaderMapping(UUID.randomUUID());
    for (ClassLoader candidate : candidates) {
        details.classLoaders.add(new WeakReference<ClassLoader>(candidate));
    }
    classLoaders.put(details.uuid, details);
    return details.uuid;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:26,代码来源:ClientSidePayloadClassLoaderRegistry.java

示例2: onActivityResult

import java.util.Set; //导入方法依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_DIALOG) {
        if (resultCode == Activity.RESULT_OK) {
            final int oldStatusSelected = mStatusSelected;
            final int oldRiskSelected = mRiskSelected;
            final ArrayList<String> oldFilteredCategories =
                    new ArrayList<>(mFilteredCategories);
            mStatusSelected = data.getIntExtra(FilterDialogFragment.STATUS, 0);
            mFilteredCategories = data.getStringArrayListExtra(FilterDialogFragment.CATEGORIES);
            final int defaultRisk = 3;
            mRiskSelected = data.getIntExtra(FilterDialogFragment.RISK, defaultRisk);
            Set<String> oldSet = new HashSet<>(oldFilteredCategories);
            Set<String> newSet = new HashSet<>(mFilteredCategories);
            if (oldStatusSelected != mStatusSelected
                    || !oldSet.equals(newSet)
                    || oldRiskSelected != mRiskSelected) {
                refreshIssues();
            }
        }
    }
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:24,代码来源:WallFragment.java

示例3: returnsSet

import java.util.Set; //导入方法依赖的package包/类
public TestDataConnection returnsSet(Set<String> expected) throws Exception {
  Connection connection = null;
  Statement statement = null;
  try {
    connection = adapter.createConnection();
    statement = connection.createStatement();
    ResultSet resultSet = statement.executeQuery(sql);
    Set<String> result = JdbcAssert.toStringSet(resultSet);
    resultSet.close();

    if (!expected.equals(result)) {
      Assert.fail(String.format("Generated set:\n%s\ndoes not match:\n%s", result, expected));
    }
    return this;
  } finally {
    if (statement != null) {
      statement.close();
    }
    if (connection != null) {
      connection.close();
    }
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:24,代码来源:JdbcAssert.java

示例4: fireFlavorsChanged

import java.util.Set; //导入方法依赖的package包/类
/**
 * Checks change of the <code>DataFlavor</code>s and, if necessary,
 * notifies all listeners that have registered interest for notification
 * on <code>FlavorEvent</code>s.
 *
 * @since 1.5
 */
private void fireFlavorsChanged() {
    if (flavorListeners == null) {
        return;
    }
    Set<DataFlavor> prevDataFlavors = currentDataFlavors;
    currentDataFlavors = getAvailableDataFlavorSet();
    if (prevDataFlavors.equals(currentDataFlavors)) {
        return;
    }
    FlavorListener[] flavorListenerArray =
            (FlavorListener[])flavorListeners.getListenersInternal();
    for (int i = 0; i < flavorListenerArray.length; i++) {
        final FlavorListener listener = flavorListenerArray[i];
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                listener.flavorsChanged(new FlavorEvent(Clipboard.this));
            }
        });
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:28,代码来源:Clipboard.java

示例5: includeSoleDependencies

import java.util.Set; //导入方法依赖的package包/类
private Set<ResourceReference> includeSoleDependencies(Set<ResourceReference> dependents) {
	while (true) {
		Set<ResourceReference> newDependents = new HashSet<>(dependents);
		for (ResourceReference dependent: dependents) {
			for (ResourceReference dependency: dependencyMap.get(dependent).getDependencies()) {
				if (!dependency.getClass().isAnnotationPresent(ResourceBundle.class) 
						&& dependents.containsAll(dependentMap.get(dependency))) {
					newDependents.add(dependency);
				}
			}
		}
		if (!newDependents.equals(dependents)) {
			dependents = newDependents;
		} else {
			break;
		}
	}
	return dependents;
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:20,代码来源:ResourceBundleReferences.java

示例6: removeDeletedBranches

import java.util.Set; //导入方法依赖的package包/类
private void removeDeletedBranches (Map<String, GitBranch> branches) {
    Set<String> localBranches = new HashSet<>();
    for (Map.Entry<String, GitBranch> b : branches.entrySet()) {
        if (!b.getValue().isRemote() && !b.getKey().equals(GitBranch.NO_BRANCH)) {
            localBranches.add(b.getKey());
        }
    }
    if (!localBranches.equals(cachedBranches)) {
        cachedBranches = localBranches;
        List<String> toRemove = new ArrayList<>(config.getSubsections(ConfigConstants.CONFIG_BRANCH_SECTION));
        boolean save = false;
        for (String branchName : toRemove) {
            if (!localBranches.contains(branchName)) {
                config.unsetSection(ConfigConstants.CONFIG_BRANCH_SECTION, branchName);
                save = true;
            }
        }
        if (save) {
            save();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:RepositoryInfo.java

示例7: testFilter

import java.util.Set; //导入方法依赖的package包/类
void testFilter(String filterArgs, Collection<Path> sourcesExpectedToBeVisible)
        throws IOException, ReflectiveOperationException {
    System.out.println("Testing filter: " + filterArgs);
    toolbox.cleanDirectory(BIN);
    toolbox.cleanDirectory(STATE_DIR);
    String args = filterArgs + " " + SRC
            + " -d " + BIN
            + " --state-dir=" + STATE_DIR;
    int rc = compile((Object[]) args.split(" "));

    // Compilation should always pass in these tests
    Assert.check(rc == Result.OK.exitCode, "Compilation failed unexpectedly.");

    // The resulting .class files should correspond to the visible source files
    Set<Path> result = allFilesInDir(BIN);
    Set<Path> expected = correspondingClassFiles(sourcesExpectedToBeVisible);
    if (!result.equals(expected)) {
        System.out.println("Result:");
        printPaths(result);
        System.out.println("Expected:");
        printPaths(expected);
        Assert.error("Test case failed: " + filterArgs);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:IncludeExcludePatterns.java

示例8: main

import java.util.Set; //导入方法依赖的package包/类
public static void main(String[] args) {
	int[][] A = MUSKET_Brute_Force.generateTestMatrix();
	MUSKET_Brute_Force.printMatrix(A);
	System.out.println(MUSKET_Brute_Force.solve_brute_force(A));
	System.out.println(getWinners(A));
	System.out.println();

	Random rnd = new Random(1);
	for (int i = 0; i < 50; i++) {
		A = MUSKET_Brute_Force.generateRandomMatrix(rnd);
		Set<Integer> w1 = MUSKET_Brute_Force.solve_brute_force(A);
		Set<Integer> w2 = getWinners(A);
		if (!w1.equals(w2)) {
			MUSKET_Brute_Force.printMatrix(A);
			System.out.println(w1);
			System.out.println(w2);
			System.out.println();
		}
	}
}
 
开发者ID:lagodiuk,项目名称:spoj,代码行数:21,代码来源:MUSKET_3.java

示例9: isSynchronized

import java.util.Set; //导入方法依赖的package包/类
public boolean isSynchronized(PatchInfoStore currentPatchInfoStore, PatchInfoStore patchInfoStore) throws MigrationException
{

    if (currentPatchInfoStore == null || patchInfoStore == null)
    {
        throw new IllegalArgumentException("currentPatchInfoStore and patchInfoStore should not be null");
    }
    Set<Integer> currentPatchInfoStorePatchesApplied = currentPatchInfoStore.getPatchesApplied();
    Set<Integer> patchInfoStorePatchesApplied = patchInfoStore.getPatchesApplied();

    return currentPatchInfoStorePatchesApplied.equals(patchInfoStorePatchesApplied);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:MissingPatchMigrationRunnerStrategy.java

示例10: updateTopology

import java.util.Set; //导入方法依赖的package包/类
private void updateTopology() {
    Set<ClusterNode> newTopology = localGossip.members().values().stream()
        .filter(s -> s.node().equals(node) || s.status() == UP)
        .map(GossipNodeState::node)
        .collect(Collectors.toSet());

    newTopology = Collections.unmodifiableSet(newTopology);

    Set<ClusterNode> oldTopology = lastTopology;

    GossipNodeState thisNode = localGossip.member(id);

    GossipNodeStatus newStatus = thisNode.status();
    GossipNodeStatus oldStatus = this.lastStatus;

    if (oldStatus != newStatus) {
        lastStatus = newStatus;
        lastTopology = newTopology;

        listener.onStatusChange(oldStatus, newStatus, thisNode.order(), newTopology);
    } else if (!oldTopology.equals(newTopology)) {
        lastTopology = newTopology;

        listener.onTopologyChange(oldTopology, newTopology);
    }

    updateKnownAddresses();

    updateWatchNodes();
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:31,代码来源:GossipManager.java

示例11: setClusterPath

import java.util.Set; //导入方法依赖的package包/类
public void setClusterPath(List<ClusterInfo> clusterPathList) {
    Set<ClusterInfo> newClusterPath = new LinkedHashSet<ClusterInfo>(clusterPathList);
    if (newClusterPath.equals(getClusterPath())) {
        return;
    }
    if (clusterPath.isEmpty()) {
        // setting cluster.path for the 1st time, needs to adjust build-impl.xml of all sub-projects
        refreshBuildScripts = true;
    }
    clusterPath = newClusterPath;
    clusterPathChanged = true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:SuiteProperties.java

示例12: check

import java.util.Set; //导入方法依赖的package包/类
/**
 *  Check that a directory contains the expected files.
 */
void check(File dir, String... paths) {
    Set<String> found = new TreeSet<String>(Arrays.asList(dir.list()));
    Set<String> expect = new TreeSet<String>(Arrays.asList(paths));
    if (found.equals(expect))
        return;
    for (String f: found) {
        if (!expect.contains(f))
            error("Unexpected file found: " + f);
    }
    for (String e: expect) {
        if (!found.contains(e))
            error("Expected file not found: " + e);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:IgnoreIgnorableCharactersInInput.java

示例13: filter

import java.util.Set; //导入方法依赖的package包/类
/** Applies the filters to the metadata layers. */
ImageLayers<CachedLayerWithMetadata> filter() throws CacheMetadataCorruptedException {
  try {
    ImageLayers<CachedLayerWithMetadata> filteredLayers = new ImageLayers<>();

    for (CachedLayerWithMetadata layer : layers) {
      if (type != null) {
        if (type != layer.getType()) {
          continue;
        }
      }

      if (sourceFiles != null) {
        if (layer.getMetadata() == null) {
          continue;
        }
        List<String> cachedLayerSourceFilePaths = layer.getMetadata().getSourceFiles();
        if (cachedLayerSourceFilePaths != null) {
          Set<Path> cachedLayerSourceFiles = new HashSet<>();
          for (String sourceFile : cachedLayerSourceFilePaths) {
            cachedLayerSourceFiles.add(Paths.get(sourceFile));
          }
          if (!cachedLayerSourceFiles.equals(sourceFiles)) {
            continue;
          }
        }
      }

      filteredLayers.add(layer);
    }

    return filteredLayers;

  } catch (DuplicateLayerException | LayerPropertyNotFoundException ex) {
    throw new CacheMetadataCorruptedException(ex);
  }
}
 
开发者ID:GoogleCloudPlatform,项目名称:minikube-build-tools-for-java,代码行数:38,代码来源:CacheMetadata.java

示例14: checkFiles

import java.util.Set; //导入方法依赖的package包/类
private void checkFiles(Set<String> foundFiles, Set<String> expectFiles, Object where) {
    if (!foundFiles.equals(expectFiles)) {
        Set<String> missing = new TreeSet<String>(expectFiles);
        missing.removeAll(foundFiles);
        if (!missing.isEmpty())
            error("the following files were not found in " + where + ": " + missing);
        Set<String> unexpected = new TreeSet<String>(foundFiles);
        unexpected.removeAll(expectFiles);
        if (!unexpected.isEmpty())
            error("the following unexpected files were found in " + where + ": " + unexpected);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:APITest.java

示例15: checkLinkingValidity

import java.util.Set; //导入方法依赖的package包/类
private void checkLinkingValidity(final Symbol docID, final ArgumentOutput docOutput,
    final Optional<LinkingStore> linkingStore) throws IOException {
  final Optional<ResponseLinking> responseLinking = linkingStore.get().read(docOutput);
  if (!responseLinking.isPresent()) {
    throw new RuntimeException("Linking missing for " + docID);
  }
  final Set<Response> allLinkedResponses = ImmutableSet
      .copyOf(Iterables.concat(responseLinking.get().responseSets()));
  final Set<Response> nonGenericArgumentResponses = Sets
      .filter(docOutput.responses(), NOT_GENERIC);
  if (!allLinkedResponses.equals(nonGenericArgumentResponses)) {
    final StringBuilder msg = new StringBuilder();
    msg.append(
        "The set of linked responses should exactly equal the set of non-generic argument responses. However, ");
    final Set<Response> linkingOnly =
        Sets.difference(allLinkedResponses, nonGenericArgumentResponses);
    final Set<Response> argumentOnly =
        Sets.difference(nonGenericArgumentResponses, allLinkedResponses);

    if (!linkingOnly.isEmpty()) {
      msg.append("\nThe following are in the linking only:\n ")
          .append(StringUtils.NewlineJoiner.join(linkingOnly));
    }
    if (!argumentOnly.isEmpty()) {
      msg.append("\nThe following are in the argument output only:\n")
          .append(StringUtils.NewlineJoiner.join(argumentOnly));
    }
    throw new RuntimeException(msg.toString());
  }
  if (!linkingValidator.validate(responseLinking.get())) {
    throw new RuntimeException(String.format("Validation failed for %s with validator %s", docID,
        linkingValidator.getClass().toString()));
  }
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:35,代码来源:ValidateSystemOutput.java


注:本文中的java.util.Set.equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。