yangys
2024-04-04 2cf2921440e7473ae50796c2cb688f609b3a7995
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.qianwen.core.tool.tuple;
 
import com.qianwen.core.tool.utils.StringPool;
 
/* loaded from: blade-core-tool-9.3.0.0-SNAPSHOT.jar:org/springblade/core/tool/tuple/Pair.class */
public class Pair<L, R> {
    private static final Pair<Object, Object> EMPTY = new Pair<>(null, null);
    private final L left;
    private final R right;
 
    public String toString() {
        return "Pair(left=" + getLeft() + ", right=" + getRight() + StringPool.RIGHT_BRACKET;
    }
 
    public boolean equals(final Object o) {
        if (o == this) {
            return true;
        }
        if (o instanceof Pair) {
            Pair<?, ?> other = (Pair) o;
            if (other.canEqual(this)) {
                Object this$left = getLeft();
                Object other$left = other.getLeft();
                if (this$left == null) {
                    if (other$left != null) {
                        return false;
                    }
                } else if (!this$left.equals(other$left)) {
                    return false;
                }
                Object this$right = getRight();
                Object other$right = other.getRight();
                return this$right == null ? other$right == null : this$right.equals(other$right);
            }
            return false;
        }
        return false;
    }
 
    protected boolean canEqual(final Object other) {
        return other instanceof Pair;
    }
 
    public int hashCode() {
        Object $left = getLeft();
        int result = (1 * 59) + ($left == null ? 43 : $left.hashCode());
        Object $right = getRight();
        return (result * 59) + ($right == null ? 43 : $right.hashCode());
    }
 
    public L getLeft() {
        return this.left;
    }
 
    public R getRight() {
        return this.right;
    }
 
    public static <L, R> Pair<L, R> empty() {
        return (Pair<L, R>) EMPTY;
    }
 
    public static <L, R> Pair<L, R> createLeft(L left) {
        if (left == null) {
            return empty();
        }
        return new Pair<>(left, null);
    }
 
    public static <L, R> Pair<L, R> createRight(R right) {
        if (right == null) {
            return empty();
        }
        return new Pair<>(null, right);
    }
 
    public static <L, R> Pair<L, R> create(L left, R right) {
        if (right == null && left == null) {
            return empty();
        }
        return new Pair<>(left, right);
    }
 
    private Pair(L left, R right) {
        this.left = left;
        this.right = right;
    }
}