Storing different types inside a list?

后端 未结 6 1026
广开言路
广开言路 2021-02-19 03:34

Related: A list of multiple data types?

I want to know how to store different array types (including system types) inside an array.

The above question covered ho

6条回答
  •  眼角桃花
    2021-02-19 03:59

    If you are willing to give away type safety you can use an ArrayList, which was the only way to use a list of stuff pre generics.

    You can put some wrapper code around it to only accept doubles and strings.

提交回复
热议问题