OLD | NEW |
| (Empty) |
1 /* | |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | |
3 * Copyright (C) 2006-2016 Eyeo GmbH | |
4 * | |
5 * Adblock Plus is free software: you can redistribute it and/or modify | |
6 * it under the terms of the GNU General Public License version 3 as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * Adblock Plus is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | |
16 */ | |
17 | |
18 package org.adblockplus.libadblockplus; | |
19 | |
20 public class HeaderEntry | |
21 { | |
22 private final String key; | |
23 private final String value; | |
24 | |
25 public HeaderEntry(final String key, final String value) | |
26 { | |
27 this.key = key; | |
28 this.value = value; | |
29 } | |
30 | |
31 public static HeaderEntry of(final String key, final String value) | |
32 { | |
33 return new HeaderEntry(key, value); | |
34 } | |
35 | |
36 public String getKey() | |
37 { | |
38 return this.key; | |
39 } | |
40 | |
41 public String getValue() | |
42 { | |
43 return this.value; | |
44 } | |
45 | |
46 @Override | |
47 public int hashCode() | |
48 { | |
49 return this.key.hashCode() * 31 + this.value.hashCode(); | |
50 } | |
51 | |
52 @Override | |
53 public boolean equals(final Object o) | |
54 { | |
55 if (!(o instanceof HeaderEntry)) | |
56 { | |
57 return false; | |
58 } | |
59 final HeaderEntry other = (HeaderEntry) o; | |
60 return this.key.equals(other.key) && this.value.equals(other.value); | |
61 } | |
62 | |
63 @Override | |
64 public String toString() | |
65 { | |
66 return this.key + ": " + this.value; | |
67 } | |
68 } | |
OLD | NEW |