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


Java AbstractIntIterator类代码示例

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


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

示例1: keySet

import it.unimi.dsi.fastutil.ints.AbstractIntIterator; //导入依赖的package包/类
/** Returns a type-specific-set view of the keys of this map.
 *
 * <P>The view is backed by the set returned by {@link #entrySet()}. Note that
 * <em>no attempt is made at caching the result of this method</em>, as this would
 * require adding some attributes that lightweight implementations would
 * not need. Subclasses may easily override this policy by calling
 * this method and caching the result, but implementors are encouraged to
 * write more efficient ad-hoc implementations.
 *
 * @return a set view of the keys of this map; it may be safely cast to a type-specific interface.
 */
public IntSet keySet() {
 return new AbstractIntSet () {
   public boolean contains( final int k ) { return containsKey( k ); }
   public int size() { return AbstractInt2IntMap.this.size(); }
   public void clear() { AbstractInt2IntMap.this.clear(); }
   public IntIterator iterator() {
    return new AbstractIntIterator () {
      final ObjectIterator<Map.Entry<Integer,Integer>> i = entrySet().iterator();
      public int nextInt() { return ((Int2IntMap.Entry )i.next()).getIntKey(); };
      public boolean hasNext() { return i.hasNext(); }
     };
   }
  };
}
 
开发者ID:kkrugler,项目名称:yalder,代码行数:26,代码来源:AbstractInt2IntMap.java

示例2: values

import it.unimi.dsi.fastutil.ints.AbstractIntIterator; //导入依赖的package包/类
/** Returns a type-specific-set view of the values of this map.
 *
 * <P>The view is backed by the set returned by {@link #entrySet()}. Note that
 * <em>no attempt is made at caching the result of this method</em>, as this would
 * require adding some attributes that lightweight implementations would
 * not need. Subclasses may easily override this policy by calling
 * this method and caching the result, but implementors are encouraged to
 * write more efficient ad-hoc implementations.
 *
 * @return a set view of the values of this map; it may be safely cast to a type-specific interface.
 */
public IntCollection values() {
 return new AbstractIntCollection () {
   public boolean contains( final int k ) { return containsValue( k ); }
   public int size() { return AbstractInt2IntMap.this.size(); }
   public void clear() { AbstractInt2IntMap.this.clear(); }
   public IntIterator iterator() {
    return new AbstractIntIterator () {
      final ObjectIterator<Map.Entry<Integer,Integer>> i = entrySet().iterator();
      public int nextInt() { return ((Int2IntMap.Entry )i.next()).getIntValue(); };
      public boolean hasNext() { return i.hasNext(); }
     };
   }
  };
}
 
开发者ID:kkrugler,项目名称:yalder,代码行数:26,代码来源:AbstractInt2IntMap.java

示例3: outdegrees

import it.unimi.dsi.fastutil.ints.AbstractIntIterator; //导入依赖的package包/类
/** Returns an iterator enumerating the outdegrees of the nodes of this graph.
 * 
 * @return  an iterator enumerating the outdegrees of the nodes of this graph.
 */
public IntIterator outdegrees() {
	return randomAccess() ? 
	new AbstractIntIterator() {
		private final int n = numNodes();
		private int next = 0;
		@Override
		public boolean hasNext() {
			return next < n;
		}
		@Override
		public int nextInt() {
			if ( ! hasNext() ) throw new NoSuchElementException();
			return outdegree( next++ ); 
		}
	} :
	new AbstractIntIterator() {
		private final NodeIterator nodeIterator = nodeIterator();
		@Override
		public boolean hasNext() {
			return nodeIterator.hasNext();
		}
		@Override
		public int nextInt() {
			nodeIterator.nextInt();
			return nodeIterator.outdegree();
		}
	};
}
 
开发者ID:lhelwerd,项目名称:WebGraph,代码行数:33,代码来源:ImmutableGraph.java


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