當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。