1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.hadoop.hbase.io.hfile;
21
22 import java.util.Iterator;
23
24 import org.apache.hadoop.hbase.classification.InterfaceAudience;
25
26
27
28
29 @InterfaceAudience.Private
30 class BlockCachesIterator implements Iterator<CachedBlock> {
31 int index = 0;
32 final BlockCache [] bcs;
33 Iterator<CachedBlock> current;
34
35 BlockCachesIterator(final BlockCache [] blockCaches) {
36 this.bcs = blockCaches;
37 this.current = this.bcs[this.index].iterator();
38 }
39
40 @Override
41 public boolean hasNext() {
42 if (current.hasNext()) return true;
43 this.index++;
44 if (this.index >= this.bcs.length) return false;
45 this.current = this.bcs[this.index].iterator();
46 return hasNext();
47 }
48
49 @Override
50 public CachedBlock next() {
51 return this.current.next();
52 }
53
54 @Override
55 public void remove() {
56 throw new UnsupportedOperationException();
57 }
58 }