java类重写equals和hashCode方法
来源:互联网 发布:java怎么输入字符串 编辑:程序博客网 时间:2024/06/07 06:08
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof FilmInfo)) {
return false;
}
FilmInfo filmInfo = (FilmInfo ) o;
return filmSource == filmInfo.filmSource && Objects.equals(sourceFilmId, filmInfo.sourceFilmId) && Objects.equals(filmName, filmInfo.filmName) &&
Objects.equals(showtime, filmInfo.showtime) && Objects.equals(picture, filmInfo.picture) && Objects.equals(filmLength, filmInfo.filmLength) &&
Objects.equals(country, filmInfo.country) && Objects.equals(language, filmInfo.language);
}
@Override
public int hashCode() {
return Objects.hash(filmSource, sourceFilmId, filmName,showtime,picture,filmLength,country,language);
}
public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof FilmInfo)) {
return false;
}
FilmInfo filmInfo = (FilmInfo ) o;
return filmSource == filmInfo.filmSource && Objects.equals(sourceFilmId, filmInfo.sourceFilmId) && Objects.equals(filmName, filmInfo.filmName) &&
Objects.equals(showtime, filmInfo.showtime) && Objects.equals(picture, filmInfo.picture) && Objects.equals(filmLength, filmInfo.filmLength) &&
Objects.equals(country, filmInfo.country) && Objects.equals(language, filmInfo.language);
}
@Override
public int hashCode() {
return Objects.hash(filmSource, sourceFilmId, filmName,showtime,picture,filmLength,country,language);
}
阅读全文
0 0
- java类重写equals和hashCode方法
- java 重写类的equals方法和hashcode方法
- JAVA类中的equals()方法和hashCode()方法的重写
- java重写equals和hashCode方法
- java中重写equals和hashCode方法
- java重写equals和hashCode方法
- Java中equals和hashcode方法重写
- java 重写equals() 和 hashcode()方法
- String类重写equals()和hashCode()方法
- 重写hashCode和equals方法
- 重写equals和hashCode方法
- 重写hashCode和equals方法
- 重写hashcode和equals方法
- 重写equals() 和 hashCode()方法
- 重写hashCode()和equals()方法
- 重写equals和hashcode方法
- HashCode和equals方法重写
- 重写equals() 和 hashCode()方法
- 粒子系统学习(1)
- eclipse中复制web项目
- Spring bean在相同xml文件和不同的xml文件中引用的方式
- 优化图片的小尝试
- Java 学习-对象
- java类重写equals和hashCode方法
- mysql根据条件做特定的更新
- 文本相似度-词袋模型
- Sublime Text 3 快捷键总结
- 布局
- struts2 搭建环境后出现 no action mapped for namespace 的解决方法
- 浅谈Java中的equals和==
- Struts2学习笔记(4)-ActionSupport类及Action接口详解
- Word2003入门动画教程46:用“碎片”复制或移动文章