Hi. I'm writing a parser for a format that contain...
# getting-started
g
Hi. I'm writing a parser for a format that contains heterogeneous values that don't share a common class (other than
Object
). What's the best / most idiomatic way to represent that collection? In TypeScript I'd do something like
Array<Type1 | Type2>
, but I don't know how to do something like that on Kotlin/Java/JVM.
w
Array<Any> maybe? Like you can use any in ts
otherwise I think you’ll need to make an empty interface and have all objects implement it
g
Thanks @willyrs!