Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为 Contact 添加 hashCode() 方法 #585

Closed
Itsusinn opened this issue Sep 10, 2020 · 5 comments
Closed

为 Contact 添加 hashCode() 方法 #585

Itsusinn opened this issue Sep 10, 2020 · 5 comments
Labels
t:feature 类型: 新特性 z:declined 状态: 被拒绝的特性

Comments

@Itsusinn
Copy link

为Group,Friend添加hashCode()方法,使HashMap正常工作

@Itsusinn Itsusinn added the t:feature 类型: 新特性 label Sep 10, 2020
@Him188 Him188 changed the title 为Group,Friend添加hashCode()方法 为 Contact 添加 hashCode() 方法 Sep 10, 2020
@Him188 Him188 added the N 优先级: 一般 label Sep 10, 2020
@Him188 Him188 added this to the 1.3.0 milestone Sep 10, 2020
@Him188
Copy link
Member

Him188 commented Sep 15, 2020

它现在不就是可以正常工作?

@Him188
Copy link
Member

Him188 commented Sep 15, 2020

这些对象都是唯一的, 不需要实现通用的某种 hash

@Him188 Him188 modified the milestones: 1.3.0, 2.0-M1 Sep 15, 2020
@Him188
Copy link
Member

Him188 commented Sep 15, 2020

如有必要, 请使用 id 作为键

@Itsusinn
Copy link
Author

在我换了一种方式初始化HashMap后,可以正常工作
不过之前的确出现了同一个key的value被两次初始化的情况
我正准备复现,推测是与mirai无关的问题

@sandtechnology
Copy link
Collaborator

不应该将Group和Friend对象作为HashMap的对象,因为它不应该被缓存,它是由mirai管理的
如果需要存储,建议自行新建容器类并实现hashcode方法或者直接使用long

@Him188 Him188 added z:declined 状态: 被拒绝的特性 and removed N 优先级: 一般 labels Sep 16, 2020
@Him188 Him188 closed this as completed Sep 16, 2020
@Him188 Him188 removed this from the 2.0-M1 milestone Sep 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t:feature 类型: 新特性 z:declined 状态: 被拒绝的特性
Projects
None yet
Development

No branches or pull requests

3 participants