Esempio n. 1
0
 /**
  * Fast iterator over entries (it can reuse entry objects).
  *
  * @param state The state of entries to iterate.
  * @return a fast iterator over all key/value pairs
  * @see it.unimi.dsi.fastutil.longs.Long2DoubleMap.FastEntrySet#fastIterator()
  *     Long2DoubleMap.FastEntrySet.fastIterator()
  * @since 0.11
  */
 public Iterator<VectorEntry> fastIterator(VectorEntry.State state) {
   IntIterator iter;
   switch (state) {
     case SET:
       iter = keys.activeIndexIterator(isMutable());
       break;
     case UNSET:
       {
         iter = keys.clone().invert().activeIndexIterator(false);
         break;
       }
     case EITHER:
       {
         iter = IntIterators.fromTo(0, keys.domainSize());
         break;
       }
     default: // should be impossible
       throw new IllegalArgumentException("invalid entry state");
   }
   return new FastIterImpl(iter, state);
 }
Esempio n. 2
0
 /**
  * Get the set of unset keys. This is \(D \\ S\), where \(D\) is the key domain and \(S\) the key
  * set.
  */
 public LongSortedSet unsetKeySet() {
   return keys.clone().invert().activeSetView();
 }