I’m trying to do something like the following
def defined(hash: HashMap[T, U], key: [T) {
hash.contains(key)
}
The above does not compile because my syntax is incorrect. Is it possible to check if a HashMap of unknown type contains a given key?
Other than the stray “[” I don’t think you have a syntax error. That and you need an “=” before your braces, or the function won’t be returning the bool. And since there is only one expression, no need for braces…