1package com.bumptech.glide.util;
2
3/**
4 * A key of two {@link Class}es to be used in hashed collections.
5 */
6public class MultiClassKey {
7    private Class<?> first;
8    private Class<?> second;
9
10    public MultiClassKey() {
11        // leave them null
12    }
13
14    public MultiClassKey(Class<?> first, Class<?> second) {
15        set(first, second);
16    }
17
18    public void set(Class<?> first, Class<?> second) {
19        this.first = first;
20        this.second = second;
21    }
22
23    @Override
24    public String toString() {
25        return "MultiClassKey{"
26                + "first=" + first
27                + ", second=" + second
28                + '}';
29    }
30
31    @Override
32    public boolean equals(Object o) {
33        if (this == o) {
34            return true;
35        }
36        if (o == null || getClass() != o.getClass()) {
37            return false;
38        }
39
40        MultiClassKey that = (MultiClassKey) o;
41
42        if (!first.equals(that.first)) {
43            return false;
44        }
45        if (!second.equals(that.second)) {
46            return false;
47        }
48
49        return true;
50    }
51
52    @Override
53    public int hashCode() {
54        int result = first.hashCode();
55        result = 31 * result + second.hashCode();
56        return result;
57    }
58}
59