Skip to content

Commit dbb7330

Browse files
committed
Allow to set an argument explicitly to null, without falling back to the default value
1 parent abb236e commit dbb7330

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/main/java/org/scijava/optional/AbstractOptions.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ public String toString()
7373
@Override
7474
public < T > T getValueOrDefault( final String key, final T defaultValue )
7575
{
76-
@SuppressWarnings( "unchecked" )
77-
final T value = ( T ) theOptions.get( key );
78-
return value == null ? defaultValue : value;
76+
return theOptions.containsKey( key ) ? ( T ) theOptions.get( key ) : defaultValue;
7977
}
8078
}
8179

0 commit comments

Comments
 (0)