What is an array, and how does it differ from a list or a hashmap in terms of memory and performance?