aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/dulkirfabric/config/Pair.kt
blob: cf5e91472fbb7c7fd884473c0384b6c3bf7ceef4 (plain)
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
package com.dulkirfabric.config

class Pair<T, R>(val t: T, val r: R) {

    fun getLeft(): T {
        return t
    }

    fun getRight(): R {
        return r
    }

    override fun equals(other: Any?): Boolean {
        if (this === other) {
            return true
        } else if (other != null && this::class == other::class) {
            other as Pair<*, *>
            return t == other.t && r == other.r
        }
        return false
    }

    override fun hashCode(): Int {
        var result = t?.hashCode() ?: 0
        result = 31 * result + (r?.hashCode() ?: 0)
        return result
    }
}