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


Java Collection.removeAll方法代码示例

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


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

示例1: convertToMode

import java.util.Collection; //导入方法依赖的package包/类
public RBExpression convertToMode(ModeCheckContext context, boolean rearrange) throws TypeModeError {
	Collection freevars = query.getFreeVariables(context);
	Collection extractedVars = getExtract().getVariables();
	freevars.removeAll(extractedVars);
	
	if (!freevars.isEmpty()) {
		return Factory.makeModedExpression(
			this,
			new ErrorMode("Variables improperly left unbound in COUNT: " 
				+ freevars),
			context);
	} else {
		RBExpression convQuery = query.convertToMode(context, rearrange);
		Mode convertedMode = convQuery.getMode();
		if (convertedMode instanceof ErrorMode) { 
			return Factory.makeModedExpression(this, convQuery.getMode(), 
				convQuery.getNewContext());
		} else {
			ModeCheckContext newContext = (ModeCheckContext)context.clone();
			result.makeAllBound(newContext);
			return Factory.makeModedExpression(
				new RBCountAll(convQuery, getExtract(), getResult()),
				convertedMode.findAll(), newContext);
		}
	}
}
 
开发者ID:aserg-ufmg,项目名称:RefDiff,代码行数:27,代码来源:RBCountAll.java

示例2: mapTargetIdsToNames

import java.util.Collection; //导入方法依赖的package包/类
@Override
public Map<TargetId, String> mapTargetIdsToNames(Collection<TargetId> targetIds)
{
	Map<TargetId, String> rv = Maps.newHashMap();
	for( PrivilegeTreeProvider provider : providers.getBeanList() )
	{
		provider.mapTargetIdsToNames(targetIds, rv);

		targetIds.removeAll(rv.keySet());
		if( targetIds.isEmpty() )
		{
			break;
		}
	}
	return rv;
}
 
开发者ID:equella,项目名称:Equella,代码行数:17,代码来源:PrivilegeTreeServiceImpl.java

示例3: getStorageDirs

import java.util.Collection; //导入方法依赖的package包/类
private static Collection<URI> getStorageDirs(Configuration conf,
                                              String propertyName) {
  Collection<String> dirNames = conf.getTrimmedStringCollection(propertyName);
  StartupOption startOpt = NameNode.getStartupOption(conf);
  if(startOpt == StartupOption.IMPORT) {
    // In case of IMPORT this will get rid of default directories 
    // but will retain directories specified in hdfs-site.xml
    // When importing image from a checkpoint, the name-node can
    // start with empty set of storage directories.
    Configuration cE = new HdfsConfiguration(false);
    cE.addResource("core-default.xml");
    cE.addResource("core-site.xml");
    cE.addResource("hdfs-default.xml");
    Collection<String> dirNames2 = cE.getTrimmedStringCollection(propertyName);
    dirNames.removeAll(dirNames2);
    if(dirNames.isEmpty())
      LOG.warn("!!! WARNING !!!" +
        "\n\tThe NameNode currently runs without persistent storage." +
        "\n\tAny changes to the file system meta-data may be lost." +
        "\n\tRecommended actions:" +
        "\n\t\t- shutdown and restart NameNode with configured \"" 
        + propertyName + "\" in hdfs-site.xml;" +
        "\n\t\t- use Backup Node as a persistent and up-to-date storage " +
        "of the file system meta-data.");
  } else if (dirNames.isEmpty()) {
    dirNames = Collections.singletonList(
        DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_DEFAULT);
  }
  return Util.stringCollectionAsURIs(dirNames);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:FSNamesystem.java

示例4: removeWithBoth

import java.util.Collection; //导入方法依赖的package包/类
private boolean removeWithBoth(Collection<IRecipe> from)
{
    List<IRecipe> recipes = from.stream()
                                .filter(this::matchesOutput)
                                .filter(this::matchesInput)
                                .collect(Collectors.toList());

    return from.removeAll(recipes);
}
 
开发者ID:cubex2,项目名称:customstuff4,代码行数:10,代码来源:ShapelessRecipe.java

示例5: gradleTestKitFileCollection

import java.util.Collection; //导入方法依赖的package包/类
private FileCollectionInternal gradleTestKitFileCollection(Collection<File> testKitClasspath) {
    List<File> gradleApi = classPathRegistry.getClassPath(GRADLE_API.name()).getAsFiles();
    testKitClasspath.removeAll(gradleApi);

    return (FileCollectionInternal) relocatedDepsJar(testKitClasspath, "gradleTestKit()", RuntimeShadedJarType.TEST_KIT)
        .plus(gradleApiFileCollection(gradleApi));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:8,代码来源:DependencyClassPathNotationConverter.java

示例6: onSelectionChanged

import java.util.Collection; //导入方法依赖的package包/类
@Override
protected void onSelectionChanged() {
	Collection<ContactId> selected = adapter.getSelectedContactIds();
	Collection<ContactId> disabled = adapter.getDisabledContactIds();
	selected.removeAll(disabled);

	// tell the activity which contacts have been selected
	listener.contactsSelected(selected);
}
 
开发者ID:rafjordao,项目名称:Nird2,代码行数:10,代码来源:RevealContactsFragment.java

示例7: prependTools

import java.util.Collection; //导入方法依赖的package包/类
private static List<File> prependTools(List<File> origCp) {
    final Collection<File> tools = new LinkedHashSet<>();
    addJARs(tools, new File(new File(System.getProperty("java.home")).getParentFile(), "lib")); //NOI18N
    tools.removeAll(origCp);
    final List<File> res = new ArrayList<>(tools.size() + origCp.size());
    res.addAll(tools);
    res.addAll(origCp);
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:AntBridge.java

示例8: accumulateChoices

import java.util.Collection; //导入方法依赖的package包/类
private void accumulateChoices(Collection<GoodsType> workTypes,
                               Collection<GoodsType> tried,
                               List<Collection<GoodsType>> result) {
    workTypes.removeAll(tried);
    if (!workTypes.isEmpty()) {
        result.add(workTypes);
        tried.addAll(workTypes);
    }
}
 
开发者ID:FreeCol,项目名称:freecol,代码行数:10,代码来源:Colony.java

示例9: prepareRootFiles

import java.util.Collection; //导入方法依赖的package包/类
/**
 * Adds the given file into filesUnderRoot:
 * <ul>
 * <li>if the file was already in the set, does nothing and returns true</li>
 * <li>if the file lies under a folder already present in the set, does nothing and returns true</li>
 * <li>if the file and none of it's ancestors is not in the set yet, this adds the file into the set,
 * removes all it's children and returns false</li>
 * @param repository repository root
 * @param filesUnderRoot set of repository roots
 * @param file file to add
 * @return false if the file was added or true if it was already contained
 */
public static boolean prepareRootFiles (File repository, Collection<File> filesUnderRoot, File file) {
    boolean added = false;
    Set<File> filesToRemove = new HashSet<File>();
    for (File fileUnderRoot : filesUnderRoot) {
        if (file.equals(fileUnderRoot) || fileUnderRoot.equals(repository)) {
            // file has already been inserted or scan is planned for the whole repository root
            added = true;
            break;
        }
        if (file.equals(repository)) {
            // plan the scan for the whole repository root
            // adding the repository, there's no need to leave all other files
            filesUnderRoot.clear();
            break;
        } else {
            if (file.getAbsolutePath().length() < fileUnderRoot.getAbsolutePath().length()) {
                if (Utils.isAncestorOrEqual(file, fileUnderRoot)) {
                    filesToRemove.add(fileUnderRoot);
                }
            } else {
                if (Utils.isAncestorOrEqual(fileUnderRoot, file)) {
                    added = true;
                    break;
                }
            }
        }
    }
    filesUnderRoot.removeAll(filesToRemove);
    if (!added) {
        // not added yet
        filesUnderRoot.add(file);
    }
    return added;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:47,代码来源:GitUtils.java

示例10: removeValuesFromCollection

import java.util.Collection; //导入方法依赖的package包/类
public void removeValuesFromCollection(Collection result) {
  Iterator valuesIter = map.values().iterator();
  while (valuesIter.hasNext()) {
    Object value = valuesIter.next();
    if (value instanceof Collection)
      result.removeAll((Collection) value);
    else
      result.remove(value);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:AbstractIndex.java

示例11: keysSpi

import java.util.Collection; //导入方法依赖的package包/类
@Override
protected String[] keysSpi() throws BackingStoreException {
    synchronized (AuxiliaryConfigBasedPreferencesProvider.this) {
        Collection<String> result = new LinkedHashSet<String>();

        if (!isRemovedNode(path)) {
            result.addAll(list(EL_PROPERTY));
        }
        
        if (ap != null) {
            String prefix = toPropertyName(path, "");
            
            for (String key : ap.listKeys(shared)) {
                if (key.startsWith(prefix)) {
                    String name = key.substring(prefix.length());
                    
                    if (name.length() > 0 && name.indexOf('.') == (-1)) {
                        result.add(decodeString(name));
                    }
                }
            }
        }

        result.addAll(getData(path).keySet());
        result.removeAll(getRemoved(path));

        return result.toArray(new String[0]);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:AuxiliaryConfigBasedPreferencesProvider.java

示例12: removeFromCollection

import java.util.Collection; //导入方法依赖的package包/类
/**
 * Remove queries from another collection
 *
 * @param collection The items from which should be removed
 * @param remove     The items to remove
 * @return The filtered collection
 */
private <T extends Suggestable> Collection<Suggestion<T>> removeFromCollection(Collection<Suggestion<T>> collection, Collection<Suggestion<T>> remove) {

    Set<Suggestion<T>> toBeRemoved = new HashSet<>();
    for (Suggestion<T> entry : collection) {
        for (Suggestion<T> removalEntry : remove) {
            if (entry.getData().equals(removalEntry.getData())) {
                toBeRemoved.add(entry);
            }
        }
    }

    collection.removeAll(toBeRemoved);
    return collection;
}
 
开发者ID:hyperrail,项目名称:hyperrail-for-android,代码行数:22,代码来源:PersistentQueryProvider.java

示例13: checkReferencedTypes

import java.util.Collection; //导入方法依赖的package包/类
private static void checkReferencedTypes(Collection<String> knownTypes, Collection<String> referencedTypes, String type) throws BioNLPSTException {
	referencedTypes.removeAll(knownTypes);
	if (!referencedTypes.isEmpty()) {
		String msg = "schema for " + type + " references unknown types " + Strings.join(referencedTypes, ", ");
		throw new BioNLPSTException(msg);
	}

}
 
开发者ID:Bibliome,项目名称:bibliome-java-utils,代码行数:9,代码来源:DocumentSchema.java

示例14: remove

import java.util.Collection; //导入方法依赖的package包/类
@Override
public boolean remove(final Node[] arr) {
    synchronized (COLLECTION_LOCK) {
        final Collection<Node> collection = getCollection();
        // fast check
        boolean same = false;
        if (collection.size() == arr.length) {
            same = true;
            int i = 0;
            for (Node n : collection) {
                if (n != arr[i++]) {
                    same = false;
                    break;
                }
            }
        }
        if (same) {
            collection.clear();
        } else {
            if (!collection.removeAll(Arrays.asList(arr))) {
                // the collection was not changed
                return false;
            }
        }
    }

    refresh();

    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:Children.java

示例15: removeAll

import java.util.Collection; //导入方法依赖的package包/类
@Override
public boolean removeAll(Collection<?> c) {
    final Collection<V> coll = getMapping();
    if (coll == null) {
        return false;
    }

    boolean result = coll.removeAll(c);
    if (coll.isEmpty()) {
        AbstractMultiValuedMap.this.remove(key);
    }
    return result;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:14,代码来源:AbstractMultiValuedMap.java


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