Skip to content

Commit

Permalink
fix: Wrong name for mapping both L/R types in pair
Browse files Browse the repository at this point in the history
  • Loading branch information
Col-E committed Sep 9, 2022
1 parent 83f6848 commit 4293d57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>software.coley</groupId>
<artifactId>extra-collections</artifactId>
<version>1.2.0</version>
<version>1.2.1</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/software/coley/collections/tuple/Pair.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public <RM> Pair<L, RM> mapRight(Function<R, RM> mapper) {
*
* @return Pair with mapped values.
*/
public <LM, RM> Pair<LM, RM> mapRight(Function<L, LM> leftMapper, Function<R, RM> rightMapper) {
public <LM, RM> Pair<LM, RM> mapBoth(Function<L, LM> leftMapper, Function<R, RM> rightMapper) {
return new Pair<>(leftMapper.apply(left), rightMapper.apply(right));
}

Expand All @@ -102,7 +102,7 @@ public <LM, RM> Pair<LM, RM> mapRight(Function<L, LM> leftMapper, Function<R, RM
*
* @return {@code true} if the {@link Map#get(Object)} of the {@link #getLeft()} is {@link #getRight()}.
*/
public boolean mapContains(Map<L, R> map) {
public boolean mapContainsKeyValue(Map<L, R> map) {
if (map.containsKey(left))
return Objects.equals(map.get(left), right);
return false;
Expand Down Expand Up @@ -147,7 +147,9 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(left, right);
int result = left != null ? left.hashCode() : 0;
result = 31 * result + (right != null ? right.hashCode() : 0);
return result;
}

@Override
Expand Down

0 comments on commit 4293d57

Please sign in to comment.