@@ -105,7 +105,7 @@ private LauncherData() {
105
105
}
106
106
107
107
private void verifyIsModular (boolean isModular ) {
108
- if ((moduleInfo != null ) ! = isModular ) {
108
+ if ((moduleInfo == null ) = = isModular ) {
109
109
throw new IllegalStateException ();
110
110
}
111
111
}
@@ -266,14 +266,10 @@ private static String getMainModule(Map<String, ? super Object> params) {
266
266
private static String getStringParam (Map <String , ? super Object > params ,
267
267
String paramName ) {
268
268
Optional <Object > value = Optional .ofNullable (params .get (paramName ));
269
- if (value .isPresent ()) {
270
- return value .get ().toString ();
271
- }
272
- return null ;
269
+ return value .map (Object ::toString ).orElse (null );
273
270
}
274
271
275
- private static <T > T getPathParam (Map <String , ? super Object > params ,
276
- String paramName , Supplier <T > func ) throws ConfigException {
272
+ private static <T > T getPathParam (String paramName , Supplier <T > func ) throws ConfigException {
277
273
try {
278
274
return func .get ();
279
275
} catch (InvalidPathException ex ) {
@@ -285,7 +281,7 @@ private static <T> T getPathParam(Map<String, ? super Object> params,
285
281
286
282
private static Path getPathParam (Map <String , ? super Object > params ,
287
283
String paramName ) throws ConfigException {
288
- return getPathParam (params , paramName , () -> {
284
+ return getPathParam (paramName , () -> {
289
285
String value = getStringParam (params , paramName );
290
286
Path result = null ;
291
287
if (value != null ) {
@@ -304,21 +300,17 @@ private static List<Path> getModulePath(Map<String, ? super Object> params)
304
300
runtimePath = runtimePath .resolve ("lib" );
305
301
modulePath = Stream .of (modulePath , List .of (runtimePath ))
306
302
.flatMap (List ::stream )
307
- .collect ( Collectors . toUnmodifiableList () );
303
+ .toList ( );
308
304
}
309
305
310
306
return modulePath ;
311
307
}
312
308
313
309
private static List <Path > getPathListParameter (String paramName ,
314
310
Map <String , ? super Object > params ) throws ConfigException {
315
- return getPathParam (params , paramName , () -> {
316
- String value = (String ) params .get (paramName );
317
- return (value == null ) ? List .of () :
318
- List .of (value .split (File .pathSeparator )).stream ()
319
- .map (Path ::of )
320
- .collect (Collectors .toUnmodifiableList ());
321
- });
311
+ return getPathParam (paramName , () ->
312
+ params .get (paramName ) instanceof String value ?
313
+ Stream .of (value .split (File .pathSeparator )).map (Path ::of ).toList () : List .of ());
322
314
}
323
315
324
316
private String qualifiedClassName ;
0 commit comments