public static boolean areEqual(Bundle bundle1,Bundle bundle2){
  if (bundle1 == null) {
    return bundle2 == null;
  }
 else   if (bundle2 == null) {
    return false;
  }
 else   if (bundle1 == bundle2) {
    return true;
  }
  Set<String> keySet=bundle1.keySet();
  if (!keySet.equals(bundle2.keySet())) {
    return false;
  }
  for (  String key : keySet) {
    Object value1=bundle1.get(key);
    Object value2=bundle2.get(key);
    if (!(value1 == null ? value2 == null : value1.equals(value2))) {
      return false;
    }
  }
  return true;
}

public static boolean areEqual ( Bundle bundle1 , Bundle bundle2 ) { if ( bundle1 == null ) { return bundle2 == null ; } else if ( bundle2 == null ) { return false ; } else if ( bundle1 == bundle2 ) { return true ; } Set < String > keySet = bundle1 . keySet ( ) ; if ( ! keySet . equals ( bundle2 . keySet ( ) ) ) { return false ; } for ( String key : keySet ) { Object value1 = bundle1 . get ( key ) ; Object value2 = bundle2 . get ( key ) ; if ( ! ( value1 == null ? value2 == null : value1 . equals ( value2 ) ) ) { return false ; } } return true ; }
this is a convenience method to test whether or not two bundles ' contents are equal . this method only works if the contents of each bundle are primitive data types or strings . otherwise this method may wrongly report they they are not equal .
