本文整理匯總了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();
}
}
示例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();
}
示例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;
}