I'm not really sure of the difference or even definitions of arrays or array lists, so this blog post is sure to help me out.
Arrays are systematic arrangement of objects, usually in rows and columns. Specifically in computer science, they are a collection of data items that can be selected by indices computed at run-time.
An arraylist is an implementation of List , backed by an array. All optional operations including adding, removing, and replacing elements are supported.
Now for the differences...
Arrays:
- random-access, linear data structure
- fixed size once created
- can contain objects and primitives
- must declare element type
- safe: run-time bounds checking
Arraylists:
- random-access, linear data structure
- dynamic size; grows automatically
- can only contain objects
Hope that answers all questions!
Until next time.
xoxo,
Yung Coder
Arrays are systematic arrangement of objects, usually in rows and columns. Specifically in computer science, they are a collection of data items that can be selected by indices computed at run-time.
An arraylist is an implementation of List , backed by an array. All optional operations including adding, removing, and replacing elements are supported.
Now for the differences...
Arrays:
- random-access, linear data structure
- fixed size once created
- can contain objects and primitives
- must declare element type
- safe: run-time bounds checking
Arraylists:
- random-access, linear data structure
- dynamic size; grows automatically
- can only contain objects
- element type is object
- safe: run-time bounds checking
Hope that answers all questions!
Until next time.
xoxo,
Yung Coder