Skip to content

Commit

Permalink
#845 Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
theigl committed Jan 23, 2022
1 parent 6698d22 commit df9296a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/com/esotericsoftware/kryo/util/IdentityMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@
* @author Tommy Ettinger
* @author Nathan Sweet */
public class IdentityMap<K, V> extends ObjectMap<K, V> {
/** Creates a new map with an initial capacity of 51 and a load factor of 0.75 */
/** Creates a new map with an initial capacity of 51 and a load factor of 0.8 */
public IdentityMap () {
super();
}

/** Creates a new map with a load factor of 0.75
/** Creates a new map with a load factor of 0.8
* @param initialCapacity If not a power of two, it is increased to the next nearest power of two. */
public IdentityMap (int initialCapacity) {
super(initialCapacity);
Expand Down
8 changes: 4 additions & 4 deletions src/com/esotericsoftware/kryo/util/IntMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,17 @@ public V get (int key) {
if (key == 0) return hasZeroValue ? zeroValue : null;
for (int i = place(key);; i = i + 1 & mask) {
int other = keyTable[i];
if (other == key) return valueTable[i]; // Same key was found.
if (other == 0) return null; // Empty space is available.
if (other == 0) return null;
if (other == key) return valueTable[i];
}
}

public V get (int key, @Null V defaultValue) {
if (key == 0) return hasZeroValue ? zeroValue : null;
for (int i = place(key);; i = i + 1 & mask) {
int other = keyTable[i];
if (other == key) return valueTable[i]; // Same key was found.
if (other == 0) return defaultValue; // Empty space is available.
if (other == 0) return defaultValue;
if (other == key) return valueTable[i];
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/com/esotericsoftware/kryo/util/ObjectMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,17 @@ private void putResize (K key, @Null V value) {
public <T extends K> V get (T key) {
for (int i = place(key);; i = i + 1 & mask) {
K other = keyTable[i];
if (key.equals(other)) return valueTable[i]; // Same key was found.
if (other == null) return null; // Empty space is available.
if (other == null) return null;
if (key.equals(other)) return valueTable[i];
}
}

/** Returns the value for the specified key, or the default value if the key is not in the map. */
public V get (K key, @Null V defaultValue) {
for (int i = place(key);; i = i + 1 & mask) {
K other = keyTable[i];
if (key.equals(other)) return valueTable[i]; // Same key was found.
if (other == null) return defaultValue; // Empty space is available.
if (other == null) return defaultValue;
if (key.equals(other)) return valueTable[i];
}
}

Expand Down

0 comments on commit df9296a

Please sign in to comment.