public static void Maybe <K, V>(Action <V, K> action, K key, ImMap <K, V> map) { if (!map.Has(key)) { return; } action(map[key], key); }
public static T Maybe <K, V, T>(Func <V, K, T> action, K key, ImMap <K, V> map) { if (!map.Has(key)) { return(default(T)); } return(action(map[key], key)); }
private ImMap <string, LocatorTarget> GetTargetList( string domain, ImMap <string, ImMap <string, LocatorTarget> > registrationList ) { if (!registrationList.Has(domain)) { return(Im.Map <LocatorTarget>()); } return(RegistrationList[domain]); }
private LocatorTarget GetTargetFromTargetList( string address, ImMap <string, LocatorTarget> targetList ) { if (!targetList.Has(address)) { // MEMO: do error handling inside a plug return(new LocatorTarget()); } return(targetList[address]); }