|
@@ -143,9 +143,7 @@ public class CoreProfilesDialogModel implements ProfilesDialogModel {
|
143
|
143
|
@Override
|
144
|
144
|
public void setSelectedProfile(final Optional<MutableProfile> profile) {
|
145
|
145
|
checkNotNull(profile, "profile cannot be null");
|
146
|
|
- if (profile.isPresent()) {
|
147
|
|
- checkArgument(profiles.containsValue(profile.get()), "Profile must exist in list");
|
148
|
|
- }
|
|
146
|
+ profile.ifPresent(mutableProfile -> checkArgument(profiles.containsValue(mutableProfile), "Profile must exist in list"));
|
149
|
147
|
if (!selectedProfile.equals(profile)) {
|
150
|
148
|
selectedProfile = profile;
|
151
|
149
|
listeners.getCallable(ProfilesDialogModelListener.class).profileSelectionChanged(profile);
|
|
@@ -273,10 +271,8 @@ public class CoreProfilesDialogModel implements ProfilesDialogModel {
|
273
|
271
|
public void setSelectedProfileSelectedNickname(final Optional<String> selectedNickname) {
|
274
|
272
|
checkNotNull(selectedNickname, "Nickname cannot be null");
|
275
|
273
|
selectedProfile.ifPresent(p -> {
|
276
|
|
- if (selectedNickname.isPresent()) {
|
277
|
|
- checkArgument(p.getNicknames().contains(selectedNickname.get()),
|
278
|
|
- "Nickname must exist in nicknames list");
|
279
|
|
- }
|
|
274
|
+ selectedNickname.ifPresent(s -> checkArgument(p.getNicknames().contains(s),
|
|
275
|
+ "Nickname must exist in nicknames list"));
|
280
|
276
|
if (this.selectedNickname != selectedNickname) {
|
281
|
277
|
this.selectedNickname = selectedNickname;
|
282
|
278
|
listeners.getCallable(ProfilesDialogModelListener.class)
|
|
@@ -289,10 +285,8 @@ public class CoreProfilesDialogModel implements ProfilesDialogModel {
|
289
|
285
|
public void setSelectedProfileSelectedHighlight(final Optional<String> selectedHighlight) {
|
290
|
286
|
checkNotNull(selectedHighlight, "Highlight cannot be null");
|
291
|
287
|
selectedProfile.ifPresent(p -> {
|
292
|
|
- if (selectedHighlight.isPresent()) {
|
293
|
|
- checkArgument(p.getHighlights().contains(selectedHighlight.get()),
|
294
|
|
- "Nickname must exist in nicknames list");
|
295
|
|
- }
|
|
288
|
+ selectedHighlight.ifPresent(s -> checkArgument(p.getHighlights().contains(s),
|
|
289
|
+ "Nickname must exist in nicknames list"));
|
296
|
290
|
if (this.selectedHighlight != selectedHighlight) {
|
297
|
291
|
this.selectedHighlight = selectedHighlight;
|
298
|
292
|
listeners.getCallable(ProfilesDialogModelListener.class)
|