@@ -115,17 +115,16 @@ static FirefoxOptions fromJsonMap(Map<String, Object> map) throws IOException {
115115 if (map .containsKey ("prefs" )) {
116116 @ SuppressWarnings ("unchecked" ) // #YOLO
117117 Map <String , Object > prefs = (Map ) getOption (map , "prefs" , Map .class );
118- prefs .entrySet ().forEach (entry -> {
119- Object value = entry .getValue ();
118+ prefs .forEach ((key , value ) -> {
120119 if (value instanceof Boolean ) {
121- options .addPreference (entry . getKey () , (Boolean ) value );
120+ options .addPreference (key , (Boolean ) value );
122121 } else if (value instanceof Integer || value instanceof Long ) {
123- options .addPreference (entry . getKey () , ((Number ) value ).intValue ());
122+ options .addPreference (key , ((Number ) value ).intValue ());
124123 } else if (value instanceof String ) {
125- options .addPreference (entry . getKey () , (String ) value );
124+ options .addPreference (key , (String ) value );
126125 } else {
127126 throw new WebDriverException (
128- "Invalid Firefox preference value: " + entry . getKey () + "=" + value );
127+ "Invalid Firefox preference value: " + key + "=" + value );
129128 }
130129 });
131130 }
@@ -255,9 +254,9 @@ public FirefoxOptions setProfile(FirefoxProfile profile) {
255254
256255 if (!booleanPrefs .isEmpty () || !intPrefs .isEmpty () || !stringPrefs .isEmpty ()) {
257256 LOG .info ("Will update profile with preferences from these options." );
258- booleanPrefs .entrySet (). forEach (e -> profile . setPreference ( e . getKey (), e . getValue ()) );
259- intPrefs .entrySet (). forEach (e -> profile . setPreference ( e . getKey (), e . getValue ()) );
260- stringPrefs .entrySet (). forEach (e -> profile . setPreference ( e . getKey (), e . getValue ()) );
257+ booleanPrefs .forEach (profile :: setPreference );
258+ intPrefs .forEach (profile :: setPreference );
259+ stringPrefs .forEach (profile :: setPreference );
261260 }
262261
263262 desiredCapabilities .setCapability (PROFILE , profile );
@@ -285,9 +284,9 @@ Optional<FirefoxProfile> getProfileOrNull() {
285284 private FirefoxProfile fullyPopulateProfile (FirefoxProfile profile ) {
286285 populateProfile (profile , desiredCapabilities );
287286
288- booleanPrefs .entrySet (). forEach (pref -> profile . setPreference ( pref . getKey (), pref . getValue ()) );
289- intPrefs .entrySet (). forEach (pref -> profile . setPreference ( pref . getKey (), pref . getValue ()) );
290- stringPrefs .entrySet (). forEach (pref -> profile . setPreference ( pref . getKey (), pref . getValue ()) );
287+ booleanPrefs .forEach (profile :: setPreference );
288+ intPrefs .forEach (profile :: setPreference );
289+ stringPrefs .forEach (profile :: setPreference );
291290
292291 return profile ;
293292 }
0 commit comments