
Collection Framework
What is Framework? A framework is a pre-written set of classes, libraries, and rules that help developers build applications faster. Why Collection Framework? Java arrays are used to store multiple values of the same data type in a single variable. However, arrays have several limitations, which is why the Java Collection Framework was introduced. Disadvantages of Array : Fixed Size (Static Memory Allocation) : The size of an array must be defined when it is created, and it cannot be changed later. Arrays Store Only Similar Data Types(Homowgeneous) : An array can store only one type of data. No Built-in Methods : Arrays do not provide built-in functions for common operations. For example: Sorting Searching Adding elements Removing elements You must write extra code manually. Memory Wastage If you declare a large array but use only a few elements, unused memory is wasted. Advantages of Collection : Dynamic Size (Resizable): Collections can grow or shrink automatically as elements are ad
Continue reading on Dev.to Tutorial
Opens in a new tab




