public static boolean equalsIgnoreOrder ( Collection < ? > c1 , Collection < ? > c2 ) { return ( c1 == null && c2 == null ) || ( c1 != null && c2 != null && c1 . size ( ) == c2 . size ( ) && c1 . containsAll ( c2 ) && c2 . containsAll ( c1 ) ) ; }
Checks if two collections are equal ignoring the order of components . It s safe to pass collections that might be null .