Skip to content

Commit

Permalink
introduce Tuple
Browse files Browse the repository at this point in the history
  • Loading branch information
burdoto committed Dec 26, 2024
1 parent f51a6ed commit 4563ce7
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/main/java/org/comroid/api/func/util/Tuple.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package org.comroid.api.func.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Objects;

public interface Tuple {
@Data
@NoArgsConstructor
@AllArgsConstructor
class N2<A, B> implements Tuple {
public A a;
public B b;

@Override
public final int hashCode() {
return Objects.hash(a, b);
}

@Override
public final boolean equals(Object obj) {
return obj instanceof N2<?, ?> other && other.hashCode() == hashCode();
}

@Override
public String toString() {
return "( %s , %s )".formatted(a, b);
}
}
}

0 comments on commit 4563ce7

Please sign in to comment.