Java Reference
In-Depth Information
1 package weiss.util;
2
3 public class HashSet<AnyType> extends AbstractCollection<AnyType>
4 implements Set<AnyType>
5 {
6 private class HashSetIterator implements Iterator<AnyType>
7 { /* Figure 20.18 */ }
8 private static class HashEntry implements java.io.Serializable
9 { /* Figure 20.10 */ }
10
11 public HashSet( )
12 { /* Figure 20.11 */ }
13 public HashSet( Collection<? extends AnyType> other )
14 { /* Figure 20.11 */ }
15
16 public int size( )
17 { return currentSize; }
18 public Iterator<AnyType> iterator( )
19 { return new HashSetIterator( ); }
20
21 public boolean contains( Object x )
22 { /* Figure 20.12 */ }
23 private static boolean isActive( HashEntry [ ] arr, int pos )
24 { /* Figure 20.13 */ }
25 public AnyType getMatch( AnyType x )
26 { /* Figure 20.12 */ }
27
28 public boolean remove( Object x )
29 { /* Figure 20.14 */ }
30 public void clear( )
31 { /* Figure 20.14 */ }
32 public boolean add( AnyType x )
33 { /* Figure 20.15 */ }
34 private void rehash( )
35 { /* Figure 20.16 */ }
36 private int findPos( Object x )
37 { /* Figure 20.17 */ }
38
39 private void allocateArray( int arraySize )
40 { array = new HashEntry[ arraySize ]; }
41 private static int nextPrime( int n )
42 { /* Figure 20.8 */ }
43 private static boolean isPrime( int n )
44 { /* See online code */ }
45
46 private int currentSize = 0;
47 private int occupied = 0;
48 private int modCount = 0;
49 private HashEntry [ ] array;
50 }
figure 20.9
The class skeleton for
a quadratic probing
hash table
Search WWH ::




Custom Search