當前位置: 首頁>>代碼示例>>Java>>正文


Java Int2ObjectOpenHashMap.size方法代碼示例

本文整理匯總了Java中it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap.size方法的典型用法代碼示例。如果您正苦於以下問題:Java Int2ObjectOpenHashMap.size方法的具體用法?Java Int2ObjectOpenHashMap.size怎麽用?Java Int2ObjectOpenHashMap.size使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap的用法示例。


在下文中一共展示了Int2ObjectOpenHashMap.size方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: calculateLayerArrays

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //導入方法依賴的package包/類
protected void calculateLayerArrays() {
    Int2ObjectOpenHashMap<char[]> colorLayerMap = new Int2ObjectOpenHashMap<>();
    for (int i = 0; i < validBlockIds.length; i++) {
        int color = validColors[i];
        int combined = validBlockIds[i];
        if (hasAlpha(color)) {
            for (int j = 0; j < validBlockIds.length; j++) {
                int colorOther = validColors[j];
                if (!hasAlpha(colorOther)) {
                    int combinedOther = validBlockIds[j];
                    int combinedColor = combineTransparency(color, colorOther);
                    colorLayerMap.put(combinedColor, new char[]{(char) combined, (char) combinedOther});
                }
            }
        }
    }
    this.validLayerColors = new int[colorLayerMap.size()];
    this.validLayerBlocks = new char[colorLayerMap.size()][];
    int index = 0;
    for (Int2ObjectMap.Entry<char[]> entry : colorLayerMap.int2ObjectEntrySet()) {
        validLayerColors[index] = entry.getIntKey();
        validLayerBlocks[index++] = entry.getValue();
    }
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:25,代碼來源:TextureUtil.java

示例2: test

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //導入方法依賴的package包/類
@Override
public int test() {
    final Int2ObjectOpenHashMap<Integer> m_map = new Int2ObjectOpenHashMap<>( m_keys.length, m_fillFactor );
    for ( int i = 0; i < m_keys.length; ++i )
        m_map.put( m_keys[ i ], null );
    for ( int i = 0; i < m_keys.length; ++i )
        m_map.put( m_keys[ i ], null );
    return m_map.size();
}
 
開發者ID:mikvor,項目名稱:hashmapTest,代碼行數:10,代碼來源:FastUtilIntObjectMapTest.java

示例3: getLayer

import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; //導入方法依賴的package包/類
@Override
public final MappedByteBuffer getLayer(final int layerIndex)
throws OutOfMemoryError {

	if(layerIndex == 0) {
		return inputBuff;
	}

	Int2ObjectOpenHashMap<MappedByteBuffer> layersCache = thrLocLayersCache.get();
	if(layersCache == null) {
		layersCache = new Int2ObjectOpenHashMap<>(layersCacheCountLimit - 1);
		thrLocLayersCache.set(layersCache);
	}

	// check if layer exists
	MappedByteBuffer layer = layersCache.get(layerIndex - 1);
	if(layer == null) {
		// check if it's necessary to free the space first
		int layersCountToFree = layersCacheCountLimit - layersCache.size() + 1;
		final int layerSize = inputBuff.capacity();
		if(layersCountToFree > 0) {
			for(final int i : layersCache.keySet()) {
				layer = layersCache.remove(i);
				if(layer != null) {
					layersCountToFree --;
					DirectMemUtil.free(layer);
					if(layersCountToFree == 0) {
						break;
					}
				}
			}
			layersCache.trim();
		}
		// generate the layer
		layer = (MappedByteBuffer) ByteBuffer.allocateDirect(layerSize);
		final long layerSeed = Long.reverseBytes(
			(xorShift(getInitialSeed()) << layerIndex) ^ layerIndex
		);
		generateData(layer, layerSeed);
		layersCache.put(layerIndex - 1, layer);
	}
	return layer;
}
 
開發者ID:emc-mongoose,項目名稱:mongoose-base,代碼行數:44,代碼來源:CachedDataInput.java


注:本文中的it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap.size方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。