refactor: rename TriTuple to Triple

This commit is contained in:
2025-08-02 21:01:48 +08:00
parent d03154f28f
commit ab6b3206a9
2 changed files with 21 additions and 21 deletions
@@ -34,14 +34,14 @@ package com.onixbyte.tuple;
* @author siujamo * @author siujamo
* @author zihluwang * @author zihluwang
*/ */
public record ImmutableTriTuple<L, M, R>( public record ImmutableTriple<L, M, R>(
L left, L left,
M middle, M middle,
R right R right
) { ) {
/** /**
* Creates a new {@code ImmutableTriTuple} with the specified left, middle, and right elements. * Creates a new {@code ImmutableTriple} with the specified left, middle, and right elements.
* *
* @param <L> the type of the left element * @param <L> the type of the left element
* @param <M> the type of the middle element * @param <M> the type of the middle element
@@ -49,9 +49,9 @@ public record ImmutableTriTuple<L, M, R>(
* @param left the left element * @param left the left element
* @param middle the middle element * @param middle the middle element
* @param right the right element * @param right the right element
* @return a new {@code ImmutableTriTuple} containing the specified elements * @return a new {@code ImmutableTriple} containing the specified elements
*/ */
public static <L, M, R> ImmutableTriTuple<L, M, R> of(L left, M middle, R right) { public static <L, M, R> ImmutableTriple<L, M, R> of(L left, M middle, R right) {
return new ImmutableTriTuple<>(left, middle, right); return new ImmutableTriple<>(left, middle, right);
} }
} }
@@ -32,7 +32,7 @@ import java.util.Objects;
* @author siujamo * @author siujamo
* @author zihluwang * @author zihluwang
*/ */
public final class TriTuple<L, M, R> { public final class Triple<L, M, R> {
/** /**
* The left element of the triple. * The left element of the triple.
@@ -50,13 +50,13 @@ public final class TriTuple<L, M, R> {
private R right; private R right;
/** /**
* Constructs a new {@code TriTuple} with the given left, middle and right elements. * Constructs a new {@code Triple} with the given left, middle and right elements.
* *
* @param left the left element * @param left the left element
* @param middle the middle element * @param middle the middle element
* @param right the right element * @param right the right element
*/ */
public TriTuple(L left, M middle, R right) { public Triple(L left, M middle, R right) {
this.left = left; this.left = left;
this.middle = middle; this.middle = middle;
this.right = right; this.right = right;
@@ -117,22 +117,22 @@ public final class TriTuple<L, M, R> {
} }
/** /**
* Checks if this {@code TriTuple} is equal to the specified object. * Checks if this {@code Triple} is equal to the specified object.
* Two {@code TriTuple}s are considered equal if their left, middle and right elements are equal. * Two {@code Triple}s are considered equal if their left, middle and right elements are equal.
* *
* @param object the object to compare with * @param object the object to compare with
* @return {@code true} if the objects are equal, {@code false} otherwise * @return {@code true} if the objects are equal, {@code false} otherwise
*/ */
@Override @Override
public boolean equals(Object object) { public boolean equals(Object object) {
if (!(object instanceof TriTuple<?, ?, ?> triTuple)) return false; if (!(object instanceof Triple<?, ?, ?> triple)) return false;
return Objects.equals(left, triTuple.left) && return Objects.equals(left, triple.left) &&
Objects.equals(middle, triTuple.middle) && Objects.equals(middle, triple.middle) &&
Objects.equals(right, triTuple.right); Objects.equals(right, triple.right);
} }
/** /**
* Calculates the hash code for this {@code TriTuple} based on its left, middle and right elements. * Calculates the hash code for this {@code Triple} based on its left, middle and right elements.
* *
* @return the hash code value for this object * @return the hash code value for this object
*/ */
@@ -142,13 +142,13 @@ public final class TriTuple<L, M, R> {
} }
/** /**
* Returns a string representation of this {@code TriTuple}, including its left, middle and right elements. * Returns a string representation of this {@code Triple}, including its left, middle and right elements.
* *
* @return a string representation of the object * @return a string representation of the object
*/ */
@Override @Override
public String toString() { public String toString() {
return "TriTuple{" + return "Triple{" +
"left=" + left + "left=" + left +
", middle=" + middle + ", middle=" + middle +
", right=" + right + ", right=" + right +
@@ -156,7 +156,7 @@ public final class TriTuple<L, M, R> {
} }
/** /**
* Factory method to create a new {@code TriTuple} instance with the given left, middle and right elements. * Factory method to create a new {@code Triple} instance with the given left, middle and right elements.
* *
* @param left the left element * @param left the left element
* @param middle the middle element * @param middle the middle element
@@ -164,9 +164,9 @@ public final class TriTuple<L, M, R> {
* @param <L> the type of the left element * @param <L> the type of the left element
* @param <M> the type of the middle element * @param <M> the type of the middle element
* @param <R> the type of the right element * @param <R> the type of the right element
* @return a new {@code TriTuple} instance * @return a new {@code Triple} instance
*/ */
public static <L, M, R> TriTuple<L, M, R> of(L left, M middle, R right) { public static <L, M, R> Triple<L, M, R> of(L left, M middle, R right) {
return new TriTuple<>(left, middle, right); return new Triple<>(left, middle, right);
} }
} }