Skip to content

Commit 02c448b

Browse files
committed
fix code refactor
1 parent 46d3851 commit 02c448b

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/org/apache/commons/lang3/tuple/MutablePair.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,16 @@ public static <L, R> MutablePair<L, R> of(final L left, final R right) {
7878
* <p>This factory allows the pair to be created using inference to
7979
* obtain the generic types.</p>
8080
*
81-
* @param <L> the left element type.
82-
* @param <R> the right element type.
8381
* @param pair the existing pair.
8482
* @return a pair formed from the two parameters, not null.
8583
* @throws NullPointerException if {@code pair} is null.
84+
* @since 3.13.0
8685
*/
87-
public static <L,R> MutablePair<L,R> copyOf(final Pair<L,R> pair) {
88-
Objects.requireNonNull(pair, "pair");
89-
return new MutablePair<>(pair.getLeft(), pair.getRight());
86+
public static <L,R> MutablePair<L,R> copyOf(final Map.Entry<L, R> pair) {
87+
of(Objects.requireNonNull(pair, "pair"));
88+
final L left = pair.getKey();
89+
final R right = pair.getValue();
90+
return new MutablePair<>(left, right);
9091
}
9192

9293
/**

0 commit comments

Comments
 (0)