本文整理汇总了Java中gnu.trove.map.hash.TCustomHashMap类的典型用法代码示例。如果您正苦于以下问题:Java TCustomHashMap类的具体用法?Java TCustomHashMap怎么用?Java TCustomHashMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TCustomHashMap类属于gnu.trove.map.hash包,在下文中一共展示了TCustomHashMap类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testInMap
import gnu.trove.map.hash.TCustomHashMap; //导入依赖的package包/类
public void testInMap() {
Map<Integer,String> map =
new TCustomHashMap<Integer, String>( new IdentityHashingStrategy<Integer>() );
Integer first = new Integer( 0 );
Integer second = new Integer( 0 );
map.put( first, "first" );
assertEquals( 1, map.size() );
assertTrue( map.containsKey( first ));
assertFalse( map.containsKey( second ) );
assertEquals( "first", map.get( first ) );
map.put( second, "second" );
assertEquals( 2, map.size() );
assertEquals( "first", map.get( first ) );
assertEquals( "second", map.get( second ) );
map.remove( first );
assertEquals( 1, map.size() );
assertFalse( map.containsKey( first ) );
assertTrue( map.containsKey( second ) );
}
示例2: setup
import gnu.trove.map.hash.TCustomHashMap; //导入依赖的package包/类
@Setup
public void setup() {
mapMono = new THashMap0<>(1, loadFactor);
fill(mapMono);
mapPoly = new THashMap<>(1, loadFactor);
fill(mapPoly);
customMapPoly = new TCustomHashMap<>(strategy, 1, loadFactor);
fill(customMapPoly);
}
示例3: setup
import gnu.trove.map.hash.TCustomHashMap; //导入依赖的package包/类
@Override
public void setup(final int[] keys, final float fillFactor, final int oneFailureOutOf ) {
super.setup( keys, fillFactor, oneFailureOutOf );
m_map = new TCustomHashMap<>( IdentityHashingStrategy.INSTANCE, keys.length, fillFactor );
for (Integer key : m_keys)
m_map.put(key % oneFailureOutOf == 0 ? key + 1 : key, key);
}
示例4: test
import gnu.trove.map.hash.TCustomHashMap; //导入依赖的package包/类
@Override
public int test() {
final Map<Integer, Integer> m_map = new TCustomHashMap<>( IdentityHashingStrategy.INSTANCE, m_keys.length, m_fillFactor );
for ( int i = 0; i < m_keys.length; ++i )
m_map.put( m_keys[ i ], m_keys[ i ] );
for ( int i = 0; i < m_keys.length; ++i ) //same key set is used for identity tests
m_map.put( m_keys[ i ], m_keys[ i ] );
return m_map.size();
}