Skip to content

Commit

Permalink
Minor improvements to OptionsMap.
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-brandizi committed Mar 14, 2024
1 parent 96ff2e5 commit c9fd5ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/uk/ac/ebi/utils/collections/OptionsMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public default <V> V getOpt ( String key, V defaultValue, Function<String, V> co
{
Object v = this.get ( key );
if ( v == null ) return defaultValue;
if ( v instanceof String && converter != null ) return converter.apply ( (String) v );
if ( v instanceof String str && converter != null ) return converter.apply ( str );
return (V) v;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public OptionsMapWrapper ()

public OptionsMapWrapper ( Map<String, Object> base )
{
// So that we don't keep nesting wrappers.
if ( base instanceof OptionsMapWrapper wbase ) base = wbase.base;
this.base = base;
}

Expand Down Expand Up @@ -169,7 +171,7 @@ public Object merge ( String key, Object value, BiFunction<? super Object, ? sup
@Override
public String toString ()
{
return "[" + this.getClass ().getSimpleName () + "] " + base.toString ();
return base.toString ();
}

}

0 comments on commit c9fd5ce

Please sign in to comment.