File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
hibernate-core/src/main/java/org/hibernate/collection/internal Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1111import java .sql .SQLException ;
1212import java .util .ArrayList ;
1313import java .util .Collection ;
14+ import java .util .Collections ;
15+ import java .util .HashMap ;
1416import java .util .Iterator ;
1517import java .util .List ;
1618import java .util .ListIterator ;
1719import java .util .Map ;
18- import java .util .stream .Collectors ;
1920
2021import org .hibernate .HibernateException ;
2122import org .hibernate .engine .spi .SessionImplementor ;
@@ -193,7 +194,14 @@ public boolean equalsSnapshot(CollectionPersister persister) throws HibernateExc
193194 * @return Map of "equality" hashCode to List of objects
194195 */
195196private Map <Integer , List <Object >> groupByEqualityHash (List <Object > searchedBag , Type elementType ) {
196- return searchedBag .stream ().collect ( Collectors .groupingBy ( elementType ::getHashCode ) );
197+ if ( searchedBag .isEmpty () ) {
198+ return Collections .emptyMap ();
199+ }
200+ Map <Integer , List <Object >> map = new HashMap <>();
201+ for (Object o : searchedBag ) {
202+ map .computeIfAbsent ( elementType .getHashCode ( o ), k -> new ArrayList <>() ).add ( o );
203+ }
204+ return map ;
197205}
198206
199207@ Override
You can’t perform that action at this time.
0 commit comments