22
33import java .io .Serializable ;
44import java .util .Arrays ;
5+ import java .util .Objects ;
56
67/**
78 * Stas Parshin
@@ -50,29 +51,20 @@ public Boolean isVideo() {
5051 public boolean equals (Object o ) {
5152 if (this == o ) return true ;
5253 if (o == null || getClass () != o .getClass ()) return false ;
53-
5454 StickerSet that = (StickerSet ) o ;
55-
56- if (name != null ? !name .equals (that .name ) : that .name != null ) return false ;
57- if (title != null ? !title .equals (that .title ) : that .title != null ) return false ;
58- if (is_animated != null ? !is_animated .equals (that .is_animated ) : that .is_animated != null ) return false ;
59- if (contains_masks != null ? !contains_masks .equals (that .contains_masks ) : that .contains_masks != null )
60- return false ;
61- // Probably incorrect - comparing Object[] arrays with Arrays.equals
62- if (!Arrays .equals (stickers , that .stickers )) return false ;
63- if (thumb != null ? !thumb .equals (that .thumb ) : that .thumb != null ) return false ;
64-
65- return true ;
55+ return Objects .equals (name , that .name ) &&
56+ Objects .equals (title , that .title ) &&
57+ Objects .equals (is_animated , that .is_animated ) &&
58+ Objects .equals (is_video , that .is_video ) &&
59+ Objects .equals (contains_masks , that .contains_masks ) &&
60+ Arrays .equals (stickers , that .stickers ) &&
61+ Objects .equals (thumb , that .thumb );
6662 }
6763
6864 @ Override
6965 public int hashCode () {
70- int result = name != null ? name .hashCode () : 0 ;
71- result = 31 * result + (title != null ? title .hashCode () : 0 );
72- result = 31 * result + (is_animated != null ? is_animated .hashCode () : 0 );
73- result = 31 * result + (contains_masks != null ? contains_masks .hashCode () : 0 );
66+ int result = Objects .hash (name , title , is_animated , is_video , contains_masks , thumb );
7467 result = 31 * result + Arrays .hashCode (stickers );
75- result = 31 * result + (thumb != null ? thumb .hashCode () : 0 );
7668 return result ;
7769 }
7870
@@ -82,6 +74,7 @@ public String toString() {
8274 "name='" + name + '\'' +
8375 ", title='" + title + '\'' +
8476 ", is_animated=" + is_animated +
77+ ", is_video=" + is_video +
8578 ", contains_masks=" + contains_masks +
8679 ", stickers=" + Arrays .toString (stickers ) +
8780 ", thumb=" + thumb +
0 commit comments