Like #cast, but if x is None, returns an empty Dict.
(
Object x, Class<K> keyType, Class<V> valueType, String what)
| 685 | |
| 686 | /** Like {@link #cast}, but if x is None, returns an empty Dict. */ |
| 687 | public static <K, V> Dict<K, V> noneableCast( |
| 688 | Object x, Class<K> keyType, Class<V> valueType, String what) throws EvalException { |
| 689 | return x == Starlark.NONE ? empty() : cast(x, keyType, valueType, what); |
| 690 | } |
| 691 | |
| 692 | @Override |
| 693 | public Object getIndex(StarlarkSemantics semantics, Object key) throws EvalException { |