DEV Community

loading...

Discussion on: The int vs. Integer pitfall of Java's ArrayList.remove()

Collapse
awwsmm profile image
Andrew (he/him) Author

Yep! Integer is a subclass of Object, so Java assumes you're looking for a specific Integer object in your ArrayList, even if the actual subclass is something totally different, like Character.