private Entry<K, V> nextSegmentEntry() { while (segmentIndex >= 0) { Segment<K, V> segment = segments[segmentIndex]; Entry<K, V> entry = segment.getNextEntry(lastSegmentKey); if (entry == null) { segmentIndex--; lastSegmentKey = null; } else { lastSegmentKey = entry.getKey(); return entry; } } return null; }
private V nextSegmentValue() { while (segmentIndex >= 0) { Segment<K, V> segment = segments[segmentIndex]; Map.Entry<K, V> entry = segment.getNextEntry( lastSegmentKey); // todo: not the most efficient to work through Entries... if (entry == null) { segmentIndex--; lastSegmentKey = null; } else { lastSegmentKey = entry.getKey(); return entry.getValue(); } } return null; }