Skip to content

Commit

Permalink
Update kala.tuple.primitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Glavo committed Jul 10, 2024
1 parent 4581dee commit 7950a46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ public String toString() {
}
}

@Serial
private Object readResolve() {
return of(component1, component2);
}
Expand Down
13 changes: 5 additions & 8 deletions kala-base/src/main/java/kala/tuple/primitive/IntObjTuple2.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,11 @@ public int arity() {
@Override
@SuppressWarnings("unchecked")
public <U> U elementAt(int index) {
switch (index) {
case 0:
return (U) Integer.valueOf(component1);
case 1:
return (U) component2;
default:
throw new IndexOutOfBoundsException();
}
return switch (index) {
case 0 -> (U) Integer.valueOf(component1);
case 1 -> (U) component2;
default -> throw new IndexOutOfBoundsException();
};
}

public @NotNull Tuple2<@NotNull Integer, T> toTuple2() {
Expand Down

0 comments on commit 7950a46

Please sign in to comment.