I am very new to Java. I have recently come across fastutil and found ObjectArrayList class.
Is there any difference in performance if ObjectArrayList is used instead of ArrayList? What are the use cases for using ObjectArrayList?
According to fastutil documentation
A type-specific array-based list; provides some additional methods that use polymorphism to avoid (un)boxing.
There is a performance benefit to fastutil's implementation in cases where (un)boxing takes place.
The ObjectArrayList is backed by a generic type array. Whereas an ArrayList is backed by Object[] Really the performance between the two would be nominal. However FWIW, looks like this library provides primitive backed arrays IntArrayList DoubleArrayList where these boxing claims would actually see visible benefits in large datasets.
However, if you're new to Java. I'd highly recommend getting familiar with java.util.ArrayList before seeking out other variants.In most cases, taking the standard outweighs the performance benefit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With