Adapt scala code to change in Key -> Key<T>