-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Java] Ensure that Object2*HashMaps and ObjectHashSet always check eq…
…uality using the value in the map and not vice versa. (#253) * [Java] Ensure that Object2*HashMaps and ObjectHashSet always check equality using the value in the map and not vice versa. This allows implementing asymmetric keys/values which can match multiple other types. For an example see CharSequenceKey from the tests. * [Java] Refactor map equality tests. * [Java] Fix Object2ObjectHashMap#containsValue to perform equality check on the value stored rather than the value passed as an argument. Ensure that the equality is always done the same, i.e. use LangUtil#exactEquals. * [Java] Add sanity tests for Object2IntHashMap and missing value handling. * [Java] Simplify Object2ObjectHashMap. * [Java] Fix Object2IntHashMap put/containsKey/removeKey key equality check using the key from the map as the source of the comparison. * [Java] Avoid loading keys/values/entries multiple times during lookup and bulk operations. * [Java] Fix EntryIterator/MapEntry equals/hashCode implementations, i.e. handle null values as keys/values and use `Objects.equals` for the equality checks. * [Java] Replace LangUtil.exactEquals with Objects.equals. * [Java] Add tests for `Int2Int*Map.compact()`. * [Java] Suppress lgtm IOOBE warnings. * [Java] Update LGTM suppression syntax. (cherry picked from commit a320110)
- Loading branch information
1 parent
3dbf8bf
commit 164e20b
Showing
25 changed files
with
1,418 additions
and
407 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,4 +39,5 @@ private static <T extends Throwable> void rethrow(final Throwable t) throws T | |
{ | ||
throw (T)t; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.