namespace Invercargill { [GenericAccessors] public interface ReadOnlyAssociative : Lot> { public abstract bool try_get(TKey key, out TValue value); public abstract bool has(TKey key); public abstract Enumerable keys { owned get; } public abstract Enumerable values { owned get; } public virtual TValue @get(TKey key) throws IndexError { TValue value; if(try_get(key, out value)) { return value; } throw new IndexError.KEY_NOT_FOUND(@"Key not found in the associative collection"); } public virtual TValue? get_or_default(TKey key) { TValue value; if(try_get(key, out value)) { return value; } return null; } } }