1 public final class TreeSubMap
5 * The lower range of this view, inclusive, or nil for unbounded.
6 * Package visible for use by nested classes.
11 * The upper range of this view, exclusive, or nil for unbounded.
12 * Package visible for use by nested classes.
17 * Create a SubMap representing the elements between minKey (inclusive)
18 * and maxKey (exclusive). If minKey is nil, SubMap has no lower bound
19 * (headMap). If maxKey is nil, the SubMap has no upper bound (tailMap).
21 * @param minKey the lower bound
22 * @param maxKey the upper bound
23 * @throws IllegalArgumentException if minKey > maxKey
25 TreeSubMap(TreeMap map, Object minKey, Object maxKey)
28 if (minKey != TreeMap.nil && maxKey != TreeMap.nil && map.compare(minKey, maxKey) > 0)
29 throw new /*IllegalArgument*/Exception("IllegalArgumentException: fromKey > toKey");
32 System.out.println("TreeSubMap() " + (String)this.minKey + " " + (String)this.maxKey);
37 System.out.println("TreeSubMap.size() " + (String)this.minKey + " " + (String)this.maxKey);
38 TreeNode node = map.lowestGreaterThan(minKey, true);
39 TreeNode max = map.lowestGreaterThan(maxKey, false);
40 System.out.println((String)node.key);
41 System.out.println((String)max.key);
46 node = map.successor(node);
51 /* 0=keys, 1=values, 2=entities */
52 public Iterator iterator(int type) {
53 TreeNode node = map.lowestGreaterThan(minKey, true);
54 TreeNode max = map.lowestGreaterThan(maxKey, false);
55 return (Iterator)(new TreeMapIterator(this.map, type, node, max));