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


Java Vector.removeAll方法代码示例

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


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

示例1: getStationKeysNoSourceSink

import java.util.Vector; //导入方法依赖的package包/类
/**
 * This method returns all station (except sources and sinks) keys.
 */
@Override
public Vector<Object> getStationKeysNoSourceSink() {
	Vector<Object> keyset = new Vector<Object>();
	keyset.addAll(stationsKeyset);
	keyset.removeAll(sourcesKeyset);
	keyset.removeAll(sinksKeyset);
	return keyset;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:12,代码来源:CommonModel.java

示例2: getStationRegionKeysNoSourceSink

import java.util.Vector; //导入方法依赖的package包/类
/**
 * This method returns all station (except sources and sinks) and blocking region keys.
 */
@Override
public Vector<Object> getStationRegionKeysNoSourceSink() {
	Vector<Object> keyset = new Vector<Object>();
	keyset.addAll(stationsKeyset);
	keyset.removeAll(sourcesKeyset);
	keyset.removeAll(sinksKeyset);
	keyset.addAll(blockingRegionsKeyset);
	return keyset;
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:13,代码来源:CommonModel.java

示例3: getRandomWithoutReplacementSequence

import java.util.Vector; //导入方法依赖的package包/类
public static Vector<String> getRandomWithoutReplacementSequence(Random generator, int desiredSize, Vector<String> allElems) {

 		Vector<String> randomElems = new Vector<String> ();
 		HashSet<String> elemHashSet = new HashSet<String> ();
 		
 		// Build a hashSet varSet out of allElems
 		for(String anElem: allElems) {
 			elemHashSet.add(anElem);
 		}
 		
 		// Do we have enough elements to obtain a random sequence of desiredSize?
 		// If not, just use all elements for the sake of completion
 		// Ditto if we were asked to choose 0 elements
 		if ( (desiredSize <= 0) || (desiredSize >= elemHashSet.size())) {
 			randomElems = new Vector<String> (elemHashSet);
 			Collections.sort(randomElems);
 			return randomElems;
 		}
 		
 		// Randomly select variables until we have enough. As we go along, remove chosen variables to guarantee convergence.
 		// By design, we select random numbers following a uniform distribution
 		for(int i = 0; i < desiredSize; i++) {
 			
 			int pos = Utils.getRandomUniformNumber(generator, allElems.size());
 			String elem = allElems.get(pos);
 			randomElems.add(elem);
 			
 			// Ensure "Random Without Replacement" Strategy; thus remove all occurrences of elem
 			elemHashSet.remove(elem);
 			allElems.removeAll(Collections.singleton(elem));
 		}
 		
 		// The following sorting only makes sense when this method is invoked with strings representing variables, instead of attribute names
 		Collections.sort(randomElems);
 		return randomElems;		
 	}
 
开发者ID:RJMillerLab,项目名称:ibench,代码行数:37,代码来源:Utils.java


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