ArrayList with different Object Types

Keeping different types of objects in the same ArrayList object could be done by using Object generic type.

The idea here is to allow ArrayList to take any Object then check the actual type at the time of retrieving it.

The following code explains this:


Similar code samples:

Sorting ArrayList of primitive types

Click Here to Leave a Comment Below

Leave a Reply: