File tree Expand file tree Collapse file tree 2 files changed +31
-4
lines changed
main/java/rx/internal/util
test/java/rx/internal/util Expand file tree Collapse file tree 2 files changed +31
-4
lines changed Original file line number Diff line number Diff line change @@ -99,13 +99,25 @@ public synchronized String toString() {
9999 }
100100
101101 @ Override
102- public synchronized boolean equals ( Object o ) {
103- return list .equals ( o );
102+ public int hashCode ( ) {
103+ return list .hashCode ( );
104104 }
105105
106106 @ Override
107- public synchronized int hashCode () {
108- return list .hashCode ();
107+ public boolean equals (Object obj ) {
108+ if (this == obj )
109+ return true ;
110+ if (obj == null )
111+ return false ;
112+ if (getClass () != obj .getClass ())
113+ return false ;
114+ SynchronizedQueue <?> other = (SynchronizedQueue <?>) obj ;
115+ if (list == null ) {
116+ if (other .list != null )
117+ return false ;
118+ } else if (!list .equals (other .list ))
119+ return false ;
120+ return true ;
109121 }
110122
111123 @ Override
Original file line number Diff line number Diff line change 1+ package rx .internal .util ;
2+
3+ import static org .junit .Assert .assertTrue ;
4+
5+ import org .junit .Test ;
6+
7+ public class SynchronizedQueueTest {
8+
9+ @ Test
10+ public void testEquals () {
11+ SynchronizedQueue <Object > q = new SynchronizedQueue <Object >();
12+ assertTrue (q .equals (q ));
13+ }
14+
15+ }
You can’t perform that action at this time.
0 commit comments