Java Reference
In-Depth Information
1 package weiss.util;
2
3 import java.io.Serializable;
4 import java.io.IOException;
5
6 public class TreeSet<AnyType> extends AbstractCollection<AnyType>
7 implements SortedSet<AnyType>
8 {
9 private class TreeSetIterator implements Iterator<AnyType>
10 { /* Figure 19.74 */ }
11
12 private static class AANode<AnyType> implements Serializable
13 { /* Same as in Figure 19.64 */ }
14
15 private int modCount = 0;
16 private int theSize = 0;
17 private AANode<AnyType> root = null;
18 private Comparator<? super AnyType> cmp;
19 private AANode<AnyType> nullNode;
20
21 public TreeSet( )
22 { /* Figure 19.69 */ }
23 public TreeSet( Comparator<? super AnyType> c )
24 { /* Figure 19.69 */ }
25 public TreeSet( SortedSet<AnyType> other )
26 { /* Figure 19.69 */ }
27 public TreeSet( Collection<? extends AnyType> other )
28 { /* Figure 19.69 */ }
29
30 public Comparator<? super AnyType> comparator( )
31 { /* Figure 19.69 */ }
32 private void copyFrom( Collection<? extends AnyType> other )
33 { /* Figure 19.69 */ }
34
35 public int size( )
36 { return theSize; }
37
38 public AnyType first( )
39 { /* Similar to findMin; see online code. */ }
40 public AnyType last( )
41 { /* Similar to findMax; see online code. */ }
42
43 public AnyType getMatch( AnyType x )
44 { /* Figure 19.70 */ }
45
46 private AANode<AnyType> find( AnyType x )
47 { /* Figure 19.69 */ }
48 private int compare( AnyType lhs, AnyType rhs )
49 { /* Figure 19.69 */ }
50 public boolean contains( Object x )
51 { /* Figure 19.69 */ }
figure 19.68a
TreeSet class skeleton
( continues )
 
Search WWH ::




Custom Search