|
1 | 1 | package engineer.nightowl.sonos.api.domain; |
2 | 2 |
|
| 3 | +import java.util.Objects; |
| 4 | + |
3 | 5 | /** |
4 | | - * <p>SonosMetadataStatus class.</p> |
| 6 | + * <p> |
| 7 | + * SonosMetadataStatus class. |
| 8 | + * </p> |
5 | 9 | */ |
6 | | -public class SonosMetadataStatus |
7 | | -{ |
| 10 | +public class SonosMetadataStatus { |
8 | 11 | private SonosMusicContainer container; |
9 | 12 | private SonosItem currentItem; |
10 | 13 | private SonosItem nextItem; |
@@ -55,45 +58,18 @@ public void setStreamInfo(String streamInfo) { |
55 | 58 |
|
56 | 59 | @Override |
57 | 60 | public int hashCode() { |
58 | | - final int prime = 31; |
59 | | - int result = 1; |
60 | | - result = prime * result + ((container == null) ? 0 : container.hashCode()); |
61 | | - result = prime * result + ((currentItem == null) ? 0 : currentItem.hashCode()); |
62 | | - result = prime * result + ((nextItem == null) ? 0 : nextItem.hashCode()); |
63 | | - result = prime * result + ((streamInfo == null) ? 0 : streamInfo.hashCode()); |
64 | | - return result; |
| 61 | + return Objects.hash(container, currentItem, nextItem, streamInfo); |
65 | 62 | } |
66 | 63 |
|
67 | 64 | @Override |
68 | 65 | public boolean equals(Object obj) { |
69 | 66 | if (this == obj) |
70 | 67 | return true; |
71 | | - if (obj == null) |
72 | | - return false; |
73 | | - if (getClass() != obj.getClass()) |
| 68 | + if (!(obj instanceof SonosMetadataStatus)) |
74 | 69 | return false; |
75 | 70 | SonosMetadataStatus other = (SonosMetadataStatus) obj; |
76 | | - if (container == null) { |
77 | | - if (other.container != null) |
78 | | - return false; |
79 | | - } else if (!container.equals(other.container)) |
80 | | - return false; |
81 | | - if (currentItem == null) { |
82 | | - if (other.currentItem != null) |
83 | | - return false; |
84 | | - } else if (!currentItem.equals(other.currentItem)) |
85 | | - return false; |
86 | | - if (nextItem == null) { |
87 | | - if (other.nextItem != null) |
88 | | - return false; |
89 | | - } else if (!nextItem.equals(other.nextItem)) |
90 | | - return false; |
91 | | - if (streamInfo == null) { |
92 | | - if (other.streamInfo != null) |
93 | | - return false; |
94 | | - } else if (!streamInfo.equals(other.streamInfo)) |
95 | | - return false; |
96 | | - return true; |
| 71 | + return Objects.equals(container, other.container) && Objects.equals(currentItem, other.currentItem) |
| 72 | + && Objects.equals(nextItem, other.nextItem) && Objects.equals(streamInfo, other.streamInfo); |
97 | 73 | } |
98 | 74 |
|
99 | 75 | @Override |
|
0 commit comments