From ab6b3206a949380a7ecc09cb63baba577c0a7b9a Mon Sep 17 00:00:00 2001 From: zihluwang Date: Sat, 2 Aug 2025 21:01:48 +0800 Subject: [PATCH] refactor: rename `TriTuple` to `Triple` --- ...ableTriTuple.java => ImmutableTriple.java} | 10 +++--- .../tuple/{TriTuple.java => Triple.java} | 32 +++++++++---------- 2 files changed, 21 insertions(+), 21 deletions(-) rename tuple/src/main/java/com/onixbyte/tuple/{ImmutableTriTuple.java => ImmutableTriple.java} (82%) rename tuple/src/main/java/com/onixbyte/tuple/{TriTuple.java => Triple.java} (76%) diff --git a/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriTuple.java b/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriple.java similarity index 82% rename from tuple/src/main/java/com/onixbyte/tuple/ImmutableTriTuple.java rename to tuple/src/main/java/com/onixbyte/tuple/ImmutableTriple.java index 1db986b..20dda6d 100644 --- a/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriTuple.java +++ b/tuple/src/main/java/com/onixbyte/tuple/ImmutableTriple.java @@ -34,14 +34,14 @@ package com.onixbyte.tuple; * @author siujamo * @author zihluwang */ -public record ImmutableTriTuple( +public record ImmutableTriple( 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 the type of the left element * @param the type of the middle element @@ -49,9 +49,9 @@ public record ImmutableTriTuple( * @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 ImmutableTriTuple of(L left, M middle, R right) { - return new ImmutableTriTuple<>(left, middle, right); + public static ImmutableTriple of(L left, M middle, R right) { + return new ImmutableTriple<>(left, middle, right); } } diff --git a/tuple/src/main/java/com/onixbyte/tuple/TriTuple.java b/tuple/src/main/java/com/onixbyte/tuple/Triple.java similarity index 76% rename from tuple/src/main/java/com/onixbyte/tuple/TriTuple.java rename to tuple/src/main/java/com/onixbyte/tuple/Triple.java index 3f0ffe1..77d67ad 100644 --- a/tuple/src/main/java/com/onixbyte/tuple/TriTuple.java +++ b/tuple/src/main/java/com/onixbyte/tuple/Triple.java @@ -32,7 +32,7 @@ import java.util.Objects; * @author siujamo * @author zihluwang */ -public final class TriTuple { +public final class Triple { /** * The left element of the triple. @@ -50,13 +50,13 @@ public final class TriTuple { 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 { } /** - * 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 { } /** - * 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 { } /** - * 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 { * @param the type of the left element * @param the type of the middle element * @param the type of the right element - * @return a new {@code TriTuple} instance + * @return a new {@code Triple} instance */ - public static TriTuple of(L left, M middle, R right) { - return new TriTuple<>(left, middle, right); + public static Triple of(L left, M middle, R right) { + return new Triple<>(left, middle, right); } }