本文整理汇总了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;
}
示例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;
}
示例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;
}