Update of /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection
In directory sc8-pr-cvs1:/tmp/cvs-serv16060/src/net/sf/hibernate/collection
Modified Files:
Bag.java List.java Map.java ODMGCollection.java Set.java
Log Message:
collections (except bag) now implement equals(), hashCode() as specified by their collections framework contracts
Index: Bag.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Bag.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Bag.java 3 Jan 2003 13:36:00 -0000 1.2
--- Bag.java 3 Jan 2003 14:07:30 -0000 1.3
***************
*** 465,467 ****
--- 465,482 ----
}
+ public String toString() {
+ read();
+ return bag.toString();
+ }
+
+ /*public boolean equals(Object other) {
+ read();
+ return bag.equals(other);
+ }
+
+ public int hashCode(Object other) {
+ read();
+ return bag.hashCode();
+ }*/
+
}
Index: List.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/List.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** List.java 3 Jan 2003 13:36:00 -0000 1.2
--- List.java 3 Jan 2003 14:07:30 -0000 1.3
***************
*** 392,395 ****
--- 392,405 ----
}
+ public boolean equals(Object other) {
+ read();
+ return list.equals(other);
+ }
+
+ public int hashCode(Object other) {
+ read();
+ return list.hashCode();
+ }
+
}
Index: Map.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Map.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Map.java 3 Jan 2003 13:36:00 -0000 1.2
--- Map.java 3 Jan 2003 14:07:30 -0000 1.3
***************
*** 369,372 ****
--- 369,382 ----
public Map() {}
+ public boolean equals(Object other) {
+ read();
+ return map.equals(other);
+ }
+
+ public int hashCode(Object other) {
+ read();
+ return map.hashCode();
+ }
+
}
Index: ODMGCollection.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/ODMGCollection.java,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** ODMGCollection.java 1 Jan 2003 13:54:02 -0000 1.1.1.1
--- ODMGCollection.java 3 Jan 2003 14:07:30 -0000 1.2
***************
*** 11,17 ****
import net.sf.hibernate.engine.SessionImplementor;
- /**
- *
- */
public abstract class ODMGCollection
extends PersistentCollection
--- 11,14 ----
***************
*** 88,91 ****
return iter.hasNext() ? iter.next() : null;
}
!
}
--- 85,88 ----
return iter.hasNext() ? iter.next() : null;
}
!
}
Index: Set.java
===================================================================
RCS file: /cvsroot/hibernate/Hibernate2/src/net/sf/hibernate/collection/Set.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Set.java 3 Jan 2003 13:36:00 -0000 1.2
--- Set.java 3 Jan 2003 14:07:30 -0000 1.3
***************
*** 388,391 ****
--- 388,401 ----
}
+ public boolean equals(Object other) {
+ read();
+ return set.equals(other);
+ }
+
+ public int hashCode(Object other) {
+ read();
+ return set.hashCode();
+ }
+
}
|