Do

in process …

Error

Something bad happened. You should try to fix …

Success

The action is completed.

Hot Springs

Hot tags

digest

Begin by examining a non-generic class

2017/09/29

10:00:30

And voila! Suddenly the print statement displays “”. In your face, type erasure. Note that we can also use context bound syntax here:

Important note: My proposed solution is by no means pretty but I think it answers the question. In my opinion something is already seriously flawed from an OO point of view in the presented code (e.g. use of reflection) and a better solution would have to start by changing the underlying data structures. But that can only be done if we have more information how this is to be used, e.g. what kind of logic consumes the returned list.

The subprogram is said to be generic. The subprogram specification is preceded by the generic formal part consisting of the reserved word followed by a list of generic formal parameters which may be empty. The entities declared as generic are not directly usable, it is necessary to instantiate them.Similarly, generic packages can be used, for example, to implement a stack of any kind of elements:

Even after your edit(s) it is not entirely clear what you are trying to achieve but here are my assumptions: -You want to have some kind of Node object that acts as a container for different types of NodeData elements. -You want to be able to return list from this Node object that contains all NodeData elements stored in the Node container, regardless of the NodeData objects' type.

Related links

Tags

generic kind node nodedata container