Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dealing with NoClassTag when converting to arrays #69

Open
vasigorc opened this issue Dec 13, 2021 · 0 comments
Open

Dealing with NoClassTag when converting to arrays #69

vasigorc opened this issue Dec 13, 2021 · 0 comments

Comments

@vasigorc
Copy link

Hello πŸ‘‹

I have a very simple case and I couldn't find documentation on how to deal with this πŸ€·β€β™‚οΈ

I've declared a new type like this:

@newtype final case class Id(value: String)
@newtype final case class ExternalId(value: String)

Later in the code I finish up with a map mapping: Map[Id, ExternalId]. But when I need to collect it's keys/values to an array I get compilation errors:

val myIds = mapping.keys.toArray
val externalIds = mapping.values.toArray

Error:

No ClassTag available for ...Id
No ClassTag available for ...ExternalId

How is this supposed to be handled. Are newtypes incompatible with arrays because of generics?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant