private static final boolean longMultisetsEqual ( long [ ] firstDeps , long [ ] secondDeps ) { if ( firstDeps . length != secondDeps . length ) { return false ; } Arrays . sort ( firstDeps ) ; Arrays . sort ( secondDeps ) ; for ( int i = 0 ; i < firstDeps . length ; i ++ ) { if ( firstDeps [ i ] != secondDeps [ i ] ) { return false ; } } return true ; }
Checks if two multisets of long numbers contain the same keys with the same frequency