You are here:
» Java Arraylist
Java Arraylist
This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.
What is the difference between Arraylist and Hashmap? What to use when?

1 year 43 weeks ago
Tags:
ArrayList class provides methods for basic array operations.
The ArrayList class is a concrete implementation of List interface. This class supports dynamic arrays that can grow as needed. In java, standard arrays are of fixed length. After arrays are created, they cannot grow or shrink, which means you must know in advance how many elements an array will hold. However, sometimes you may not know how large an array you need. To handle this situation, collection framework has defined ArrayList class. An object of this can dynamically increase or decrease in size.
Hashmap allows you to define your own indices. Map is an object that stores key/volume pairs. Given a key, you can find its value. Keys must be unique, but values may be duplicated. The HashMap class provides the primary implementation of the map interface. The HashMap class uses a hash table to implementation of the map interface. This allows the execution time of basic operations, such as get() and put() to be constant.
Post Comment