public static Optional<MongoCredential> createCredentials(String username,String password,String database){
  if (!Strings.isNullOrEmpty(username) && !Strings.isNullOrEmpty(password) && !Strings.isNullOrEmpty(database)) {
    return Optional.of(MongoCredential.createMongoCRCredential(username,database,password.toCharArray()));
  }
 else {
    return Optional.absent();
  }
}

public static Optional < MongoCredential > createCredentials ( String username , String password , String database ) { if ( ! Strings . isNullOrEmpty ( username ) && ! Strings . isNullOrEmpty ( password ) && ! Strings . isNullOrEmpty ( database ) ) { return Optional . of ( MongoCredential . createMongoCRCredential ( username , database , password . toCharArray ( ) ) ) ; } else { return Optional . absent ( ) ; } }
creates a mongocredential if a username , password and database are supplied , or returns absent ( ) otherwise
