private boolean propertiesIncluded ( Map < Object , Object > inputMap , Map < Object , Object > existingMap ) { if ( inputMap == null ) { // If no properties are specified, then success. return true ; } else if ( existingMap == null || inputMap . size ( ) > existingMap . size ( ) ) { // If properties are specified, but none exist in the current map, // then fail. return false ; } // Loop through input list and search in the search list. Object existingValue ; for ( Entry < Object , Object > entry : inputMap . entrySet ( ) ) { existingValue = existingMap . get ( entry . getKey ( ) ) ; if ( existingValue == null || ! existingValue . equals ( entry . getValue ( ) ) ) { return false ; } } return true ; }
This method returns whether all the properties in the first Map are in the second Map .