4/19/2023 0 Comments Java collectionsThis is now changed with the introduction of Java 2 and its extensible Collections API. While versions of Java before the Java 2 platform (jdk1.2) provided collection implementations with Array, Vector, and Hashtable, they did not provide a framework within to use these collections, making efficient and intelligent use of collections non-trivial and time-consuming. Moreover, they provide interoperability and consistency between otherwise unrelated interfaces, resulting in reduced inter-object dependencies and increased flexibility, which are important attributes of good object-oriented design. They also promote software reuse, since the interfaces and behaviors they define encourage reusability by their very nature. Many OO programmers understand the benefits of collections frameworks, such as Smalltalk’s collection classes and C++’s Standard Template Library (STL).Ĭollections frameworks reduce programming effort by providing useful data structures and algorithms commonly used in most software systems, leaving more time to focus on the unique details of a development project. Methods that provide computations on collections, such as sorting, searching, reversals, and copying.ĭevelopers and managers both have much to gain by promoting the use of a collections framework. They provide core functionality of the framework without additional development work. Concrete implementations of the interfaces that characterize common types of collections. These interfaces and their methods work independently from implementation details of the objects they collect together. Abstract data types for representing collections of objects that provide behaviors for manipulating collections. Well-designed object-oriented collection frameworks provide an architecture and infrastructure with the following three characteristics: Collection FrameworksĪ collections framework represents a unified application programming interface for not only representing collections of objects, but also for manipulating them in a consistent manner at a high enough level of abstraction to encourage reusability and good object-oriented design. This is where collections frameworks become important. Whereas indexed arrays provide element access by sequential position, maps provide element access by named association.Įach of these types of arrays has its own advantages and disadvantages depending on context, but how these containers are used is another critical concern in terms of ease of use, flexibility, and reusability. Maps represent mappings of items with unique context, such as dictionaries or other keyed lists. Generally the memory position of a value is determined by applying a hashing algorithm to its key. The "value" is the element itself (or a reference to it) and the "key" is a unique identifier for that element. An array is typically used to represent a (possibly sorted) list of objects that might be traversed in stored order.Īnother common collection is the associative array, also known as a map, which is organized non-sequentially in unknown order by key/value pairs, and does not need to be permanently fixed in size when created. The most familiar container object is the indexed array, which is supported by most, if not all, modern general-purpose programming languages.Īrrays, which are typically fixed in size once created, represent a sequential arrangement of like objects where access to individual elements is via a positional index into the array. Virtually any non-trivial program in Java – or any other programming language for that matter – deals with groups of objects organized together within a collecting or containing object. By Dean Wette, OCI Principal Software Engineer
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |