当前位置: 首页>>代码示例>>Java>>正文


Java Hash.DEFAULT_INITIAL_SIZE属性代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.Hash.DEFAULT_INITIAL_SIZE属性的典型用法代码示例。如果您正苦于以下问题:Java Hash.DEFAULT_INITIAL_SIZE属性的具体用法?Java Hash.DEFAULT_INITIAL_SIZE怎么用?Java Hash.DEFAULT_INITIAL_SIZE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在it.unimi.dsi.fastutil.Hash的用法示例。


在下文中一共展示了Hash.DEFAULT_INITIAL_SIZE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRemove0

@Test
public void testRemove0() {
	IntLinkedOpenHashSet s = new IntLinkedOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = -1; i <= 1; i++ ) assertTrue( s.add( i ) );
	assertTrue( s.remove( 0 ) );
	IntListIterator iterator = s.iterator();
	assertEquals( -1, iterator.nextInt() );
	assertEquals( 1, iterator.nextInt() );
	assertFalse( iterator.hasNext() );
	
	s = new IntLinkedOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = -1; i <= 1; i++ ) assertTrue( s.add( i ) );
	iterator = s.iterator();
	assertEquals( -1, iterator.nextInt() );
	assertEquals( 0, iterator.nextInt() );
	iterator.remove();
	assertEquals( 1, iterator.nextInt() );
	assertFalse( iterator.hasNext() );

	assertFalse( s.contains( 0 ) );
	
	iterator = s.iterator();
	assertEquals( -1, iterator.nextInt() );
	assertEquals( 1, iterator.nextInt() );
	assertFalse( iterator.hasNext() );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:26,代码来源:IntLinkedOpenHashSetTest.java

示例2: testFirtLast0

@Test
public void testFirtLast0() {
	IntLinkedOpenHashSet s;
	
	s = new IntLinkedOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 0; i < 100; i++ ) assertTrue( s.add( i ) );
	for( int i = 0; i < 100; i++ ) assertEquals( i, s.removeFirstInt() );
	assertTrue( s.isEmpty() );
	
	s = new IntLinkedOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 0; i < 100; i++ ) assertTrue( s.add( i ) );
	for( int i = 100; i-- != 0; ) assertEquals( i, s.removeLastInt() );
	assertTrue( s.isEmpty() );

	s = new IntLinkedOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 100; i-- != 0; ) assertTrue( s.add( i ) );
	for( int i = 0; i < 100; i++ ) assertEquals( i, s.removeLastInt() );
	assertTrue( s.isEmpty() );

	s = new IntLinkedOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 100; i-- != 0; ) assertTrue( s.add( i ) );
	for( int i = 100; i-- != 0; ) assertEquals( i, s.removeFirstInt() );
	assertTrue( s.isEmpty() );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:24,代码来源:IntLinkedOpenHashSetTest.java

示例3: testRemove0

@Test
public void testRemove0() {
	IntOpenHashSet s = new IntOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = -1; i <= 1; i++ ) assertTrue( s.add( i ) );
	assertTrue( s.remove( 0 ) );
	IntIterator iterator = s.iterator();
	assertEquals( 1, iterator.nextInt() );
	assertEquals( -1, iterator.nextInt() );
	assertFalse( iterator.hasNext() );
	
	s = new IntOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = -1; i <= 1; i++ ) assertTrue( s.add( i ) );
	iterator = s.iterator();
	while( iterator.hasNext() ) if ( iterator.nextInt() == 0 ) iterator.remove();
	
	assertFalse( s.contains( 0 ) );
	
	iterator = s.iterator();
	int[] content = new int[ 2 ];
	content[ 0 ] = iterator.nextInt();
	content[ 1 ] = iterator.nextInt();
	assertFalse( iterator.hasNext() );
	Arrays.sort( content );
	assertArrayEquals( new int[] { -1, 1 }, content );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:25,代码来源:IntOpenHashSetTest.java

示例4: testRemove0

@Test
public void testRemove0() {
	Int2IntLinkedOpenHashMap s = new Int2IntLinkedOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = -1; i <= 1; i++ ) assertEquals( 0, s.put( i, i ) );
	s.remove( 0 );
	IntIterator iterator = s.keySet().iterator();
	assertEquals( -1, iterator.nextInt() );
	assertEquals( 1, iterator.nextInt() );
	assertFalse( iterator.hasNext() );
	
	s = new Int2IntLinkedOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = -1; i <= 1; i++ ) assertEquals( 0, s.put( i, i ) );
	iterator = s.keySet().iterator();
	assertEquals( -1, iterator.nextInt() );
	assertEquals( 0, iterator.nextInt() );
	iterator.remove();
	assertEquals( 1, iterator.nextInt() );
	assertFalse( iterator.hasNext() );

	assertFalse( s.containsKey( 0 ) );
	
	iterator = s.keySet().iterator();
	assertEquals( -1, iterator.nextInt() );
	assertEquals( 1, iterator.nextInt() );
	assertFalse( iterator.hasNext() );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:26,代码来源:Int2IntLinkedOpenHashMapTest.java

示例5: testFirtLast0

@Test
public void testFirtLast0() {
	Int2IntLinkedOpenHashMap s;
	
	s = new Int2IntLinkedOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 1; i < 100; i++ ) 
		assertEquals( 0, s.put( i, i ) );
	for( int i = 1; i < 100; i++ ) assertEquals( i, s.removeFirstInt() );
	assertTrue( s.isEmpty() );
	
	s = new Int2IntLinkedOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 0; i < 100; i++ ) assertEquals( 0, s.put( i, i ) );
	for( int i = 100; i-- != 0; ) assertEquals( i, s.removeLastInt() );
	assertTrue( s.isEmpty() );

	s = new Int2IntLinkedOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 100; i-- != 0; ) assertEquals( 0, s.put( i, i ) );
	for( int i = 0; i < 100; i++ ) assertEquals( i, s.removeLastInt() );
	assertTrue( s.isEmpty() );

	s = new Int2IntLinkedOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 100; i-- != 0; ) assertEquals( 0, s.put( i, i ) );
	for( int i = 100; i-- != 0; ) assertEquals( i, s.removeFirstInt() );
	assertTrue( s.isEmpty() );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:25,代码来源:Int2IntLinkedOpenHashMapTest.java

示例6: testAdd

@Test
public void testAdd() {
	IntLinkedOpenHashSet s = new IntLinkedOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	assertTrue( s.add( 0 ) );
	assertTrue( s.contains( 0 ) );
	assertFalse( s.contains( 1 ) );
	assertTrue( s.add( Integer.valueOf( 1 ) ) );
	assertTrue( s.contains( Integer.valueOf( 1 ) ) );
	assertFalse( s.contains( Integer.valueOf( 2 ) ) );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:10,代码来源:IntLinkedOpenHashSetTest.java

示例7: testRemove

@Test
public void testRemove() {
	IntLinkedOpenHashSet s = new IntLinkedOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 0; i < 100; i++ ) assertTrue( s.add( i ) );
	for( int i = 0; i < 100; i++ ) assertFalse( s.remove( 100 + i ) );
	assertEquals( 0, s.firstInt() );
	assertEquals( 99, s.lastInt() );
	for( int i = 50; i < 150; i++ ) assertTrue( Integer.toString( i % 100 ), s.remove( i % 100 ) );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:9,代码来源:IntLinkedOpenHashSetTest.java

示例8: testPutAndMove

@Test
public void testPutAndMove() {
	IntLinkedOpenHashSet s = new IntLinkedOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 0; i < 100; i++ ) assertTrue( s.addAndMoveToFirst( i ) );
	s.clear();
	for( int i = 0; i < 100; i++ ) assertTrue( s.addAndMoveToLast( i ) );
	assertTrue( s.addAndMoveToFirst( -1 ) );
	assertEquals( -1, s.firstInt() );
	assertTrue( s.addAndMoveToFirst( -2 ) );
	assertEquals( -2, s.firstInt() );
	assertFalse( s.addAndMoveToFirst( -1 ) );
	assertEquals( -1, s.firstInt() );
	assertFalse( s.addAndMoveToFirst( -1 ) );
	assertEquals( -1, s.firstInt() );
	assertFalse( s.addAndMoveToLast( -1 ) );
	assertEquals( -1, s.lastInt() );
	assertTrue( s.addAndMoveToLast( 100 ) );
	assertEquals( 100, s.lastInt() );
	assertTrue( s.addAndMoveToLast( 101 ) );
	assertEquals( 101, s.lastInt() );
	assertFalse( s.addAndMoveToLast( 100 ) );
	assertEquals( 100, s.lastInt() );
	assertFalse( s.addAndMoveToLast( 100 ) );
	assertEquals( 100, s.lastInt() );
	assertFalse( s.addAndMoveToFirst( 100 ) );
	assertEquals( 100, s.firstInt() );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:27,代码来源:IntLinkedOpenHashSetTest.java

示例9: testRemoveFirstLast

@Test
public void testRemoveFirstLast() {
	IntLinkedOpenHashSet s = new IntLinkedOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 0; i < 100; i++ ) assertTrue( s.add( i ) );
	assertEquals( 0, s.removeFirstInt() );
	assertEquals( 1, s.removeFirstInt() );
	assertEquals( 99, s.removeLastInt() );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:8,代码来源:IntLinkedOpenHashSetTest.java

示例10: testRemove

@Test
public void testRemove() {
	IntOpenHashSet s = new IntOpenHashSet( Hash.DEFAULT_INITIAL_SIZE );
	for( int i = 0; i < 100; i++ ) assertTrue( s.add( i ) );
	for( int i = 0; i < 100; i++ ) assertFalse( s.remove( 100 + i ) );
	for( int i = 50; i < 150; i++ ) assertTrue( Integer.toString( i % 100 ), s.remove( i % 100 ) );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:7,代码来源:IntOpenHashSetTest.java

示例11: testRemove0

@Test
public void testRemove0() {
	Int2IntOpenHashMap s = new Int2IntOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	s.defaultReturnValue( -1 );
	for( int i = -1; i <= 1; i++ ) assertEquals( -1, s.put( i, i ) );
	assertEquals( 0, s.remove( 0 ) );
	IntIterator iterator = s.keySet().iterator();
	assertEquals( 1, iterator.nextInt() );
	assertEquals( -1, iterator.nextInt() );
	assertFalse( iterator.hasNext() );
	
	s = new Int2IntOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	s.defaultReturnValue( -1 );
	for( int i = -1; i <= 1; i++ ) assertEquals( -1, s.put( i, i ) );
	iterator = s.keySet().iterator();
	while( iterator.hasNext() ) if ( iterator.nextInt() == 0 ) iterator.remove();
	
	assertFalse( s.containsKey( 0 ) );
	assertEquals( -1, s.get( 0 ) );
	
	iterator = s.keySet().iterator();
	int[] content = new int[ 2 ];
	content[ 0 ] = iterator.nextInt();
	content[ 1 ] = iterator.nextInt();
	assertFalse( iterator.hasNext() );
	Arrays.sort( content );
	assertArrayEquals( new int[] { -1, 1 }, content );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:28,代码来源:Int2IntOpenHashMapTest.java

示例12: testPut

@Test
public void testPut() {
	Int2IntLinkedOpenHashMap m = new Int2IntLinkedOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	assertEquals( 0, m.put( 0, 2 ) );
	assertEquals( 2, m.put( 0, 3 ) );
	assertEquals( 3, m.get( 0 ) );
	assertEquals( null, m.put( Integer.valueOf( 1 ), Integer.valueOf( 2 ) ) );
	assertEquals( Integer.valueOf( 2 ), m.put( Integer.valueOf( 1 ), Integer.valueOf( 3 ) ) );
	assertEquals( Integer.valueOf( 3 ), m.get( Integer.valueOf( 0 ) ) );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:10,代码来源:Int2IntLinkedOpenHashMapTest.java

示例13: testRemove

@Test
public void testRemove() {
	Int2IntLinkedOpenHashMap m = new Int2IntLinkedOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	m.defaultReturnValue( -1 );
	for( int i = 0; i < 100; i++ ) assertEquals( -1, m.put( i, i ) );
	for( int i = 0; i < 100; i++ ) assertEquals( -1, m.remove( i + 100 ) );
	for( int i = 50; i < 150; i++ ) assertEquals( i % 100, m.remove( i % 100 ) );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:8,代码来源:Int2IntLinkedOpenHashMapTest.java

示例14: testFastIterator

@Test
public void testFastIterator() {
	Int2IntLinkedOpenHashMap s = new Int2IntLinkedOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	s.defaultReturnValue( -1 );
	for( int i = 0; i < 100; i++ ) assertEquals( -1, s.put( i, i ) );
	ObjectIterator<Entry> fastIterator = s.int2IntEntrySet().fastIterator();
	Entry entry = fastIterator.next();
	int key = entry.getIntKey();
	entry.setValue( -1000 );
	assertEquals( s.get( key ), -1000 );
	fastIterator.remove();
	assertEquals( s.get( key ), -1 );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:13,代码来源:Int2IntLinkedOpenHashMapTest.java

示例15: testFastIterator

@Test
public void testFastIterator() {
	Int2IntOpenHashMap s = new Int2IntOpenHashMap( Hash.DEFAULT_INITIAL_SIZE );
	s.defaultReturnValue( -1 );
	for( int i = 0; i < 100; i++ ) assertEquals( -1, s.put( i, i ) );
	ObjectIterator<Entry> fastIterator = s.int2IntEntrySet().fastIterator();
	Entry entry = fastIterator.next();
	int key = entry.getIntKey();
	entry.setValue( -1000 );
	assertEquals( s.get( key ), -1000 );
	fastIterator.remove();
	assertEquals( s.get( key ), -1 );
}
 
开发者ID:phishman3579,项目名称:fastutil,代码行数:13,代码来源:Int2IntOpenHashMapTest.java


注:本文中的it.unimi.dsi.fastutil.Hash.DEFAULT_INITIAL_SIZE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。