@@ -62,9 +62,9 @@ public V get(K key) {
62
62
*/
63
63
public PersistentHashArrayMappedTrie <K ,V > put (K key , V value ) {
64
64
if (root == null ) {
65
- return new PersistentHashArrayMappedTrie <K , V >(new Leaf <K , V >(key , value ));
65
+ return new PersistentHashArrayMappedTrie <>(new Leaf <>(key , value ));
66
66
} else {
67
- return new PersistentHashArrayMappedTrie <K , V >(root .put (key , value , key .hashCode (), 0 ));
67
+ return new PersistentHashArrayMappedTrie <>(root .put (key , value , key .hashCode (), 0 ));
68
68
}
69
69
}
70
70
@@ -99,13 +99,13 @@ public Node<K,V> put(K key, V value, int hash, int bitsConsumed) {
99
99
if (thisHash != hash ) {
100
100
// Insert
101
101
return CompressedIndex .combine (
102
- new Leaf <K , V >(key , value ), hash , this , thisHash , bitsConsumed );
102
+ new Leaf <>(key , value ), hash , this , thisHash , bitsConsumed );
103
103
} else if (this .key == key ) {
104
104
// Replace
105
- return new Leaf <K , V >(key , value );
105
+ return new Leaf <>(key , value );
106
106
} else {
107
107
// Hash collision
108
- return new CollisionLeaf <K , V >(this .key , this .value , key , value );
108
+ return new CollisionLeaf <>(this .key , this .value , key , value );
109
109
}
110
110
}
111
111
@@ -158,21 +158,21 @@ public Node<K,V> put(K key, V value, int hash, int bitsConsumed) {
158
158
if (thisHash != hash ) {
159
159
// Insert
160
160
return CompressedIndex .combine (
161
- new Leaf <K , V >(key , value ), hash , this , thisHash , bitsConsumed );
161
+ new Leaf <>(key , value ), hash , this , thisHash , bitsConsumed );
162
162
} else if ((keyIndex = indexOfKey (key )) != -1 ) {
163
163
// Replace
164
164
K [] newKeys = Arrays .copyOf (keys , keys .length );
165
165
V [] newValues = Arrays .copyOf (values , keys .length );
166
166
newKeys [keyIndex ] = key ;
167
167
newValues [keyIndex ] = value ;
168
- return new CollisionLeaf <K , V >(newKeys , newValues );
168
+ return new CollisionLeaf <>(newKeys , newValues );
169
169
} else {
170
170
// Yet another hash collision
171
171
K [] newKeys = Arrays .copyOf (keys , keys .length + 1 );
172
172
V [] newValues = Arrays .copyOf (values , keys .length + 1 );
173
173
newKeys [keys .length ] = key ;
174
174
newValues [keys .length ] = value ;
175
- return new CollisionLeaf <K , V >(newKeys , newValues );
175
+ return new CollisionLeaf <>(newKeys , newValues );
176
176
}
177
177
}
178
178
@@ -238,14 +238,14 @@ public Node<K,V> put(K key, V value, int hash, int bitsConsumed) {
238
238
@ SuppressWarnings ("unchecked" )
239
239
Node <K ,V >[] newValues = (Node <K ,V >[]) new Node <?,?>[values .length + 1 ];
240
240
System .arraycopy (values , 0 , newValues , 0 , compressedIndex );
241
- newValues [compressedIndex ] = new Leaf <K , V >(key , value );
241
+ newValues [compressedIndex ] = new Leaf <>(key , value );
242
242
System .arraycopy (
243
243
values ,
244
244
compressedIndex ,
245
245
newValues ,
246
246
compressedIndex + 1 ,
247
247
values .length - compressedIndex );
248
- return new CompressedIndex <K , V >(newBitmap , newValues , size () + 1 );
248
+ return new CompressedIndex <>(newBitmap , newValues , size () + 1 );
249
249
} else {
250
250
// Replace
251
251
Node <K ,V >[] newValues = Arrays .copyOf (values , values .length );
@@ -254,7 +254,7 @@ public Node<K,V> put(K key, V value, int hash, int bitsConsumed) {
254
254
int newSize = size ();
255
255
newSize += newValues [compressedIndex ].size ();
256
256
newSize -= values [compressedIndex ].size ();
257
- return new CompressedIndex <K , V >(bitmap , newValues , newSize );
257
+ return new CompressedIndex <>(bitmap , newValues , newSize );
258
258
}
259
259
}
260
260
@@ -267,7 +267,7 @@ static <K,V> Node<K,V> combine(
267
267
Node <K ,V > node = combine (node1 , hash1 , node2 , hash2 , bitsConsumed + BITS );
268
268
@ SuppressWarnings ("unchecked" )
269
269
Node <K ,V >[] values = (Node <K ,V >[]) new Node <?,?>[] {node };
270
- return new CompressedIndex <K , V >(indexBit1 , values , node .size ());
270
+ return new CompressedIndex <>(indexBit1 , values , node .size ());
271
271
} else {
272
272
// Make node1 the smallest
273
273
if (uncompressedIndex (hash1 , bitsConsumed ) > uncompressedIndex (hash2 , bitsConsumed )) {
@@ -277,7 +277,7 @@ static <K,V> Node<K,V> combine(
277
277
}
278
278
@ SuppressWarnings ("unchecked" )
279
279
Node <K ,V >[] values = (Node <K ,V >[]) new Node <?,?>[] {node1 , node2 };
280
- return new CompressedIndex <K , V >(indexBit1 | indexBit2 , values , node1 .size () + node2 .size ());
280
+ return new CompressedIndex <>(indexBit1 | indexBit2 , values , node1 .size () + node2 .size ());
281
281
}
282
282
}
283
283
0 commit comments