public int next () { if (!hasNext) throw new NoSuchElementException(); if (!valid) throw new GdxRuntimeException("#iterator() cannot be used nested."); int key = nextIndex == INDEX_ZERO ? 0 : map.keyTable[nextIndex]; currentIndex = nextIndex; findNextIndex(); return key; }
/** Returns an iterator for the keys in the map. Remove is supported. Note that the same iterator instance is returned each * time this method is called. Use the {@link Entries} constructor for nested or multithreaded iteration. */ public Keys keys () { if (keys1 == null) { keys1 = new Keys(this); keys2 = new Keys(this); } if (!keys1.valid) { keys1.reset(); keys1.valid = true; keys2.valid = false; return keys1; } keys2.reset(); keys2.valid = true; keys1.valid = false; return keys2; }
/** * Unregisters all the subscriptions of the given listeners. * * @param listeners * The listeners to remove. */ public void removeAllSubscriptions(IObserver... listeners) { synchronized (subscriptions) { Keys km = subscriptions.keys(); while (km.hasNext) { int key = km.next(); for (IObserver listener : listeners) { subscriptions.get(key).remove(listener); } } } }
public int[] keyArray() { return keys().toArray().toArray(); }
public IntMapSerializedMap(IntMap map) { super(map); KEYS_TMP.clear(); KEYS_TMP.addAll(map.keys().toArray()); }
@Override public void reset() { super.reset(); if(map != null) { index = ascending ? 0 : map.sortedKeys.size - 1; } initHasNext(); } }
/** Returns a new array containing the remaining keys. */ public IntArray toArray () { IntArray array = new IntArray(true, map.size); while (hasNext) array.add(next()); return array; } }
public int next () { if (!hasNext) throw new NoSuchElementException(); if (!valid) throw new GdxRuntimeException("#iterator() cannot be used nested."); int key = nextIndex == INDEX_ZERO ? 0 : map.keyTable[nextIndex]; currentIndex = nextIndex; findNextIndex(); return key; }
/** Returns an iterator for the keys in the map. Remove is supported. Note that the same iterator instance is returned each * time this method is called. Use the {@link Entries} constructor for nested or multithreaded iteration. */ public Keys keys () { if (keys1 == null) { keys1 = new Keys(this); keys2 = new Keys(this); } if (!keys1.valid) { keys1.reset(); keys1.valid = true; keys2.valid = false; return keys1; } keys2.reset(); keys2.valid = true; keys1.valid = false; return keys2; }
/** Returns an iterator for the keys in the map. Remove is supported. Note that the same iterator instance is returned each * time this method is called. Use the {@link Entries} constructor for nested or multithreaded iteration. */ public Keys keys () { if (keys1 == null) { keys1 = new Keys(this); keys2 = new Keys(this); } if (!keys1.valid) { keys1.reset(); keys1.valid = true; keys2.valid = false; return keys1; } keys2.reset(); keys2.valid = true; keys1.valid = false; return keys2; }
/** Returns a new array containing the remaining keys. */ public IntArray toArray () { IntArray array = new IntArray(true, map.size); while (hasNext) array.add(next()); return array; } }
/** Returns a new array containing the remaining keys. */ public IntArray toArray () { IntArray array = new IntArray(true, map.size); while (hasNext) array.add(next()); return array; } }
public int next () { if (!hasNext) throw new NoSuchElementException(); if (!valid) throw new GdxRuntimeException("#iterator() cannot be used nested."); int key = nextIndex == INDEX_ZERO ? 0 : map.keyTable[nextIndex]; currentIndex = nextIndex; findNextIndex(); return key; }