diff options
Diffstat (limited to 'src/main/java/utils/VS3Tupel.java')
| -rw-r--r-- | src/main/java/utils/VS3Tupel.java | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/src/main/java/utils/VS3Tupel.java b/src/main/java/utils/VS3Tupel.java index ac7ffba..3ff5129 100644 --- a/src/main/java/utils/VS3Tupel.java +++ b/src/main/java/utils/VS3Tupel.java @@ -1,58 +1,59 @@ package utils; /** - * The class VS3Tupel, an object of this class represents a 3-Tupel of objects. - * Each object can have its own type. + * A generic 3-tuple record that holds three values of potentially different types. + * This is an immutable value object that provides automatic implementations of + * {@code equals()}, {@code hashCode()}, and {@code toString()}. + * + * <p>Example usage:</p> + * <pre>{@code + * VS3Tupel<String, Integer, Boolean> tuple = new VS3Tupel<>("Hello", 42, true); + * String first = tuple.a(); + * Integer second = tuple.b(); + * Boolean third = tuple.c(); + * }</pre> * + * @param <A> the type of the first element + * @param <B> the type of the second element + * @param <C> the type of the third element + * @param a the first element + * @param b the second element + * @param c the third element + * * @author Paul C. Buetow */ -public final class VS3Tupel<A,B,C> { - /** The a. */ - private A a; - - /** The b. */ - private B b; - - /** The c. */ - private C c; - - /** - * Instantiates a new tupel. - * - * @param a the a - * @param b the b - * @param c the c - */ - public VS3Tupel(A a, B b, C c) { - this.a = a; - this.b = b; - this.c = c; - } - +public record VS3Tupel<A, B, C>(A a, B b, C c) { + /** - * Gets the a. + * Gets the first element (provided for backward compatibility). * - * @return the a + * @return the first element + * @deprecated Use {@link #a()} instead */ + @Deprecated public A getA() { return a; } - + /** - * Gets the b. + * Gets the second element (provided for backward compatibility). * - * @return the b + * @return the second element + * @deprecated Use {@link #b()} instead */ + @Deprecated public B getB() { return b; } - + /** - * Gets the c. + * Gets the third element (provided for backward compatibility). * - * @return the c + * @return the third element + * @deprecated Use {@link #c()} instead */ + @Deprecated public C getC() { return c; } -} +}
\ No newline at end of file |
