Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. return new Iterator<V>()
  2. {
  3. int cur = -1;
  4. V next = computeNext();
  5. @Override
  6. public boolean hasNext()
  7. {
  8. return next != null;
  9. }
  10.  
  11. private V computeNext() {
  12. V ret = null;
  13. do {
  14. cur = availabilityMap.nextSetBit(cur + 1);
  15. ret = ids.get(cur);
  16. } while (ret == null && cur != -1);
  17. return ret;
  18. }
  19.  
  20. @Override
  21. public V next()
  22. {
  23. V ret = next;
  24. next = computeNext();
  25. return ret;
  26. }
  27. //TODO add remove support?
  28. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement