@@ -165,7 +165,7 @@ public boolean contains(T element) {
165
165
* @return true if this HashSet is empty, false otherwise.
166
166
*/
167
167
public boolean isEmpty () {
168
- return this . size () == 0 ;
168
+ return size () == 0 ;
169
169
}
170
170
171
171
/**
@@ -174,7 +174,7 @@ public boolean isEmpty() {
174
174
* @return the number of elements present in this HashSet.
175
175
*/
176
176
public int size () {
177
- return this . size ;
177
+ return size ;
178
178
}
179
179
180
180
/**
@@ -195,7 +195,7 @@ public List<T> toList() {
195
195
* @return the number of buckets of this HashSet.
196
196
*/
197
197
public int capacity () {
198
- return this . buckets .length ; // returns the number of buckets.
198
+ return buckets .length ; // returns the number of buckets.
199
199
}
200
200
201
201
/**
@@ -252,7 +252,7 @@ private int linearProbe(int hash, int collisions) {
252
252
* @return true if the bucket at the given index contains no element, false otherwise.
253
253
*/
254
254
private boolean isEmptyBucket (int bucketIndex ) {
255
- return this .isNullBucket (bucketIndex ) || this . isTombstoneBucket (bucketIndex );
255
+ return this .isNullBucket (bucketIndex ) || isTombstoneBucket (bucketIndex );
256
256
}
257
257
258
258
/**
@@ -287,14 +287,14 @@ private boolean isTombstoneBucket(int bucketIndex) {
287
287
*/
288
288
private void resize (int newCapacity ) {
289
289
// creates a temporary reference to the original bucket
290
- T [] temp = this . buckets ;
290
+ T [] temp = buckets ;
291
291
292
292
// Safe cast because the only way to add elements into this HashSet is through the add method, which
293
293
// only takes in elements of type T.
294
294
@ SuppressWarnings ("unchecked" )
295
295
T [] newBuckets = (T []) new Object [newCapacity ];
296
- this . buckets = newBuckets ;
297
- this . size = 0 ;
296
+ buckets = newBuckets ;
297
+ size = 0 ;
298
298
299
299
// re-hashes every element and re-insert into the newly created buckets.
300
300
Arrays .stream (temp )
0 commit comments