OTOH, if you are going to be using Java dealing with real world problems, many of which have aspects that are not neatly representable in Java's type system, some test of how you deal with the mismatch of that type system with a problem statement may be appropriate.
A lot of whether this is appropriate in an interview goes beyond the language used to what the job entails and what you are trying to learn about the candidate from the response.
If the subject does this property with generics that simple sum type alone requires writing several classes just to represent the sum type.
It's not clear from the article what the input is. What signature I can use depends on what the input data is. Is it a string rep of the nested list? Can I assume it's any type I want such as my own NestedList?
Obviously you can do this with brute forcing the sum type with some class hierarchy (ugh) or make the algorithm accept some List<object> or Java "List" interface.
Both of those options are pretty terrible.
I think the intents of the question are good - see if the candidates understand the importance of naming, signature, tests.
There has to be a question that does this and doesn't immediately have the subject crying over the type system.