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


Java ObjectBidirectionalIterator类代码示例

本文整理汇总了Java中it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator的典型用法代码示例。如果您正苦于以下问题:Java ObjectBidirectionalIterator类的具体用法?Java ObjectBidirectionalIterator怎么用?Java ObjectBidirectionalIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testSingleton

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testSingleton() throws IOException, ClassNotFoundException {
	final String[] s = { "a" };
	ZFastTrie<String> zft = new ZFastTrie<>(Arrays.asList(s), TransformationStrategies.prefixFreeIso());
	for (int i = s.length; i-- != 0;)
		assertTrue(s[i], zft.contains(s[i]));
	final File temp = File.createTempFile(getClass().getSimpleName(), "test");
	temp.deleteOnExit();
	BinIO.storeObject(zft, temp);
	zft = (ZFastTrie<String>)BinIO.loadObject(temp);
	for (int i = s.length; i-- != 0;)
		assertTrue(zft.contains(s[i]));

	zft.remove("a");
	assertFalse(zft.contains("a"));

	final ObjectBidirectionalIterator<String> iterator = zft.iterator();
	assertFalse(iterator.hasNext());
	assertFalse(iterator.hasPrevious());
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:22,代码来源:ZFastTrieTest.java

示例2: iteratorFromLeaf

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
private ObjectBidirectionalIterator<T> iteratorFromLeaf(final Leaf<T> from) {
	return new ObjectBidirectionalIterator<T>() {
		private Leaf<T> curr = from;

		@Override
		public boolean hasNext() {
			return curr != tail;
		}

		@Override
		public T next() {
			if (! hasNext()) throw new NoSuchElementException();
			final T result = curr.key;
			curr = curr.next;
			return result;
		}

		@Override
		public boolean hasPrevious() {
			return curr.prev != head;
		}

		@Override
		public T previous() {
			if (! hasPrevious()) throw new NoSuchElementException();
			curr = curr.prev;
			return curr.key;
		}

	};
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:32,代码来源:ZFastTrie.java

示例3: iterator

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
public ObjectBidirectionalIterator<Long2ObjectMap.Entry <V> > iterator() {
 return new EntryIterator();
}
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:4,代码来源:Long2ObjectLinkedOpenHashMap.java

示例4: fastIterator

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
public ObjectBidirectionalIterator<Long2ObjectMap.Entry <V> > fastIterator() {
 return new FastEntryIterator();
}
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:4,代码来源:Long2ObjectLinkedOpenHashMap.java

示例5: KeySetIterator

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
public KeySetIterator( ObjectBidirectionalIterator<Map.Entry <Long, V>> i ) {
 this.i = i;
}
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:4,代码来源:AbstractLong2ObjectSortedMap.java

示例6: ValuesIterator

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
public ValuesIterator( ObjectBidirectionalIterator<Map.Entry <Long, V>> i ) {
 this.i = i;
}
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:4,代码来源:AbstractLong2ObjectSortedMap.java

示例7: KeySetIterator

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
public KeySetIterator( ObjectBidirectionalIterator<Map.Entry <Integer, V>> i ) {
 this.i = i;
}
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:4,代码来源:AbstractInt2ObjectSortedMap.java

示例8: ValuesIterator

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
public ValuesIterator( ObjectBidirectionalIterator<Map.Entry <Integer, V>> i ) {
 this.i = i;
}
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:4,代码来源:AbstractInt2ObjectSortedMap.java

示例9: iterator

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
public ObjectBidirectionalIterator<Int2ObjectMap.Entry <V> > iterator() {
 return new EntryIterator();
}
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:4,代码来源:Int2ObjectLinkedOpenHashMap.java

示例10: fastIterator

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
public ObjectBidirectionalIterator<Int2ObjectMap.Entry <V> > fastIterator() {
 return new FastEntryIterator();
}
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:4,代码来源:Int2ObjectLinkedOpenHashMap.java

示例11: iterator

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
@Override
public ObjectBidirectionalIterator<T> iterator() {
	return iteratorFromLeaf(head.next);
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:5,代码来源:ZFastTrie.java

示例12: testNumbers

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testNumbers() throws IOException, ClassNotFoundException {
	ZFastTrie<String> zft;
	File temp;
	final RandomGenerator random = new XoRoShiRo128PlusRandomGenerator(1);

	for (int d = 10; d < 10000; d *= 10) {
		final String[] s = new String[d];

		for (int rand = 0; rand < 2; rand++) {
			for (int i = s.length; i-- != 0;)
				s[i] = binary(i);

			for (int pass = 0; pass < 2; pass++) {

				zft = new ZFastTrie<>(Arrays.asList(s), TransformationStrategies.prefixFreeIso());

				for (int i = s.length; i-- != 0;)
					assertTrue(s[i], zft.contains(s[i]));

				// Exercise code for negative results
				for (int i = 1000; i-- != 0;)
					zft.contains(binary(i * i + d));

				temp = File.createTempFile(getClass().getSimpleName(), "test");
				temp.deleteOnExit();
				BinIO.storeObject(zft, temp);
				zft = (ZFastTrie<String>)BinIO.loadObject(temp);
				for (int i = s.length; i-- != 0;)
					assertTrue(s[i], zft.contains(s[i]));

				zft = new ZFastTrie<>(Arrays.asList(s), new HuTuckerTransformationStrategy(Arrays.asList(s), true));

				for (int i = s.length; i-- != 0;)
					assertTrue(s[i], zft.contains(s[i]));

				temp = File.createTempFile(getClass().getSimpleName(), "test");
				temp.deleteOnExit();
				BinIO.storeObject(zft, temp);
				zft = (ZFastTrie<String>)BinIO.loadObject(temp);
				for (int i = s.length; i-- != 0;)
					assertTrue(s[i], zft.contains(s[i]));

				Collections.sort(Arrays.asList(s));

				int p = 0;
				ObjectBidirectionalIterator<String> iterator;
				for (iterator = zft.iterator(); iterator.hasNext();)
					assertEquals(iterator.next(), s[p++]);
				while (iterator.hasPrevious())
					assertEquals(iterator.previous(), s[--p]);

				for (int i = 0; i < s.length / 100; i++) {
					p = i;
					for (iterator = zft.iterator(s[i]); iterator.hasNext();)
						assertEquals(iterator.next(), s[p++]);
					while (iterator.hasPrevious())
						assertEquals(iterator.previous(), s[--p]);
				}

				for (int i = s.length; i-- != 0;) {
					assertTrue(zft.remove(s[i]));
					assertFalse(zft.contains(s[i]));
				}

				Collections.shuffle(Arrays.asList(s), new XoRoShiRo128PlusRandom(1));
			}
		}

		for (int i = s.length; i-- != 0;)
			s[i] = binary(random.nextInt(Integer.MAX_VALUE));

	}
}
 
开发者ID:vigna,项目名称:Sux4J,代码行数:76,代码来源:ZFastTrieTest.java

示例13: fastIterator

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
/** Returns a fast iterator over this sorted entry set; the iterator might return always the same entry object, suitably mutated.
 *
 * @return a fast iterator over this sorted entry set; the iterator might return always the same entry object, suitably mutated.
 */
public ObjectBidirectionalIterator<Long2ObjectMap.Entry <V> > fastIterator( Long2ObjectMap.Entry <V> from );
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:6,代码来源:Long2ObjectSortedMap.java

示例14: fastIterator

import it.unimi.dsi.fastutil.objects.ObjectBidirectionalIterator; //导入依赖的package包/类
/** Returns a fast iterator over this sorted entry set; the iterator might return always the same entry object, suitably mutated.
 *
 * @return a fast iterator over this sorted entry set; the iterator might return always the same entry object, suitably mutated.
 */
public ObjectBidirectionalIterator<Int2ObjectMap.Entry <V> > fastIterator( Int2ObjectMap.Entry <V> from );
 
开发者ID:aikar,项目名称:fastutil-lite,代码行数:6,代码来源:Int2ObjectSortedMap.java


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