當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。