| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package cz.senslog.analyzer.util;
- import java.util.Objects;
- public final class Triple<A, B, C> {
- private final A item1;
- private final B item2;
- private final C item3;
- public static <A, B, C> Triple<A, B, C> of(A item1, B item2, C item3) {
- return new Triple<>(item1, item2, item3);
- }
- private Triple(A item1, B item2, C item3) {
- this.item1 = item1;
- this.item2 = item2;
- this.item3 = item3;
- }
- public A getItem1() {
- return this.item1;
- }
- public B getItem2() {
- return this.item2;
- }
- public C getItem3() {
- return this.item3;
- }
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- } else if (o != null && this.getClass() == o.getClass()) {
- Triple<?, ?, ?> triple = (Triple<?,?, ?>)o;
- return this.item1.equals(triple.item1) && this.item2.equals(triple.item2) && this.item3.equals(triple.item3);
- } else {
- return false;
- }
- }
- public int hashCode() {
- return Objects.hash(this.item1, this.item2, this.item3);
- }
- }
|