NIMSDK-AOS  9.16.3
Entry.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.util;
2 
3 import java.io.Serializable;
4 import java.util.Objects;
5 
9 public class Entry<K extends Serializable, V extends Serializable> implements Serializable {
10  public final K key;
11  public final V value;
12 
19  public Entry(K key, V value) {
20  this.key = key;
21  this.value = value;
22  }
23 
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 
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 }
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
int hashCode()
Compute a hash code using the hash codes of the underlying objects
Definition: Entry.java:30
Entry(K key, V value)
Constructor for a Entry.
Definition: Entry.java:19
final K key
Definition: Entry.java:10
可序列化的键值对
Definition: Entry.java:9
boolean equals(Object o)
Definition: Entry.java:35
final V value
Definition: Entry.java:11