refactor: rename TriTuple to Triple
This commit is contained in:
+5
-5
@@ -34,14 +34,14 @@ package com.onixbyte.tuple;
|
||||
* @author siujamo
|
||||
* @author zihluwang
|
||||
*/
|
||||
public record ImmutableTriTuple<L, M, R>(
|
||||
public record ImmutableTriple<L, M, R>(
|
||||
L left,
|
||||
M middle,
|
||||
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 <M> the type of the middle element
|
||||
@@ -49,9 +49,9 @@ public record ImmutableTriTuple<L, M, R>(
|
||||
* @param left the left element
|
||||
* @param middle the middle 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) {
|
||||
return new ImmutableTriTuple<>(left, middle, right);
|
||||
public static <L, M, R> ImmutableTriple<L, M, R> of(L left, M middle, R right) {
|
||||
return new ImmutableTriple<>(left, middle, right);
|
||||
}
|
||||
}
|
||||
+16
-16
@@ -32,7 +32,7 @@ import java.util.Objects;
|
||||
* @author siujamo
|
||||
* @author zihluwang
|
||||
*/
|
||||
public final class TriTuple<L, M, R> {
|
||||
public final class Triple<L, M, R> {
|
||||
|
||||
/**
|
||||
* The left element of the triple.
|
||||
@@ -50,13 +50,13 @@ public final class TriTuple<L, M, R> {
|
||||
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 middle the middle 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.middle = middle;
|
||||
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.
|
||||
* Two {@code TriTuple}s are considered equal if their left, middle and right elements are equal.
|
||||
* Checks if this {@code Triple} is equal to the specified object.
|
||||
* Two {@code Triple}s are considered equal if their left, middle and right elements are equal.
|
||||
*
|
||||
* @param object the object to compare with
|
||||
* @return {@code true} if the objects are equal, {@code false} otherwise
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (!(object instanceof TriTuple<?, ?, ?> triTuple)) return false;
|
||||
return Objects.equals(left, triTuple.left) &&
|
||||
Objects.equals(middle, triTuple.middle) &&
|
||||
Objects.equals(right, triTuple.right);
|
||||
if (!(object instanceof Triple<?, ?, ?> triple)) return false;
|
||||
return Objects.equals(left, triple.left) &&
|
||||
Objects.equals(middle, triple.middle) &&
|
||||
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
|
||||
*/
|
||||
@@ -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
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TriTuple{" +
|
||||
return "Triple{" +
|
||||
"left=" + left +
|
||||
", middle=" + middle +
|
||||
", 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 middle the middle element
|
||||
@@ -164,9 +164,9 @@ public final class TriTuple<L, M, R> {
|
||||
* @param <L> the type of the left element
|
||||
* @param <M> the type of the middle 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) {
|
||||
return new TriTuple<>(left, middle, right);
|
||||
public static <L, M, R> Triple<L, M, R> of(L left, M middle, R right) {
|
||||
return new Triple<>(left, middle, right);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user