public static boolean eventsEqual ( @ Nullable final List < CommonEvent > eventsA , @ Nullable final List < CommonEvent > eventsB ) { if ( ( eventsA == null ) && ( eventsB == null ) ) { return true ; } if ( ( eventsA == null ) && ( eventsB != null ) ) { return false ; } if ( ( eventsA != null ) && ( eventsB == null ) ) { return false ; } if ( eventsA . size ( ) != eventsB . size ( ) ) { return false ; } int currentIdx = eventsA . size ( ) - 1 ; int appendIdx = eventsB . size ( ) - 1 ; while ( appendIdx >= 0 ) { final CommonEvent current = eventsA . get ( currentIdx ) ; final CommonEvent append = eventsB . get ( appendIdx ) ; if ( ! current . equals ( append ) ) { return false ; } currentIdx -- ; appendIdx -- ; } return true ; }
Tests if both lists contain the same events .