NIMSDK-AOS
9.19.0
basesdk
src
com
netease
nimlib
sdk
util
Entry.java
浏览该文件的文档.
1
package
com.netease.nimlib.sdk.util;
2
3
import
java.io.Serializable;
4
import
java.util.Objects;
5
6
/**
7
* 可序列化的键值对
8
*/
9
public
class
Entry
<K
extends
Serializable, V extends Serializable> implements Serializable {
10
public
final
K
key
;
11
public
final
V
value
;
12
13
/**
14
* Constructor for a Entry.
15
*
16
* @param key the key object in the entry
17
* @param value the value object in the entry
18
*/
19
public
Entry
(K key, V value) {
20
this.key =
key
;
21
this.value =
value
;
22
}
23
24
/**
25
* Compute a hash code using the hash codes of the underlying objects
26
*
27
* @return a hashcode of the Entry
28
*/
29
@Override
30
public
int
hashCode
() {
31
return
(key == null ? 0 : key.hashCode()) ^ (value == null ? 0 : value.hashCode());
32
}
33
34
@Override
35
public
boolean
equals
(Object o) {
36
if
(
this
== o) {
37
return
true
;
38
}
39
if
(!(o instanceof
Entry
)) {
40
return
false
;
41
}
42
Entry<?, ?>
entry = (
Entry<?, ?>
) o;
43
return
Objects.
equals
(key, entry.
key
) && Objects.equals(value, entry.
value
);
44
}
45
46
/**
47
* Convenience method for creating an appropriately typed entry.
48
*
49
* @param a the key object in the entry
50
* @param b the value object in the entry
51
* @return a Entry that is templatized with the types of a and b
52
*/
53
public
static <A extends Serializable, B extends Serializable>
Entry<A, B>
create
(A a, B b) {
54
return
new
Entry<>
(a, b);
55
}
56
}
com.netease.nimlib.sdk.util.Entry.create
static< A extends Serializable, B extends Serializable > Entry< A, B > create(A a, B b)
Convenience method for creating an appropriately typed entry.
Definition:
Entry.java:53
com.netease.nimlib.sdk.util.Entry.hashCode
int hashCode()
Compute a hash code using the hash codes of the underlying objects
Definition:
Entry.java:30
com.netease.nimlib.sdk.util.Entry.Entry
Entry(K key, V value)
Constructor for a Entry.
Definition:
Entry.java:19
com.netease.nimlib.sdk.util.Entry.key
final K key
Definition:
Entry.java:10
com.netease.nimlib.sdk.util.Entry
可序列化的键值对
Definition:
Entry.java:9
com.netease.nimlib.sdk.util.Entry.equals
boolean equals(Object o)
Definition:
Entry.java:35
com.netease.nimlib.sdk.util.Entry.value
final V value
Definition:
Entry.java:11
生成于 2024年 十月 16日 星期三 10:25:05 , 为 NIMSDK-AOS使用
1.8.13