The root interface in the Collection hierarchy which the List, Queue and Set interfaces extend. Click a link to go to detailed information about a particular class: Interface/Class The table below gives a description of each interface and class within the above diagram. and concrete implemetations which are not covered on the site, but should help in visualisation: Collection Interfaces & Classes Top The diagram has several interfaces missing and also the The diagram below is a representation of the Collection hierarchy and covers the interfaces and classes we will study in this section. There is quite a lot of information to assimilate when using collections so lets look at some hierarchy diagrams to clarify the points made so far and give an overview of what's to come: Collection Hierarchy Diagram Top We will expand on the last paragraph when we look at the sorted collection types the terminology applies to as we work through the section. The sort order is derived from properties within the objects being sorted and can be based on natural ordering such as alphabetically or numerically or in a bespoke order as defined by the programmer. Ordering but we can have ordered collections that are unsorted. This is the reason we can't have sorted unordered collections, as the sort order implicitly defines the Ordered according to the sort order and as such the ordering is defined by the sorting rules. Ordered collections allow us to iterate over our collections in a specific pre-determined way. Is ordered and unsorted, or both sorted and ordered or finally both unsorted and unordered. Each collection type can be further divided by whether it The table above shows we have two utility classes for use with collections as well as four collection types, these being lists, maps, queues and sets. Click a link to go to detailed information about a particuar class: Collection Types/Utilities & Concrete Implementation Classes Collection Hierarchy The table below lists the concrete implementation classes of the various collection types and utilities that are covered on the site. We go into great detail about the angled brackets notation in the section on generics, for now think of it as a parameterized type of Element within the collection. Utility methods we can use with our collections. When we use the term Collections using an uppercase C and ending with an s, we are referring to the class that contains a lot of static.When we use the term Collection using an uppercase C, we are referring to the interface from which:.When we use the term collection(s) using a lowercase c, this applies to any of the collection types we can store and iterate over.The collection interfaces and classes we will cover in this section all reside in the java.util package and are commonly known as The Collections Framework.īefore we start our studies of the The Collections Framework we should clarify our use of the word 'collection' as used in general Java terminology and on this site: Our primitives in prior to adding them to a collection. With the advent of autoboxing in Java this is easily solved using one of the primitive wrapper classes to wrap The major caveat being that you can only store reference variables inĬollections, whereas you can store primitives and reference variables in basic arrays. In this section we look at several more collections that allow us more flexibility and structure than the indexing mechanism of a basic array. We have already used one such collection when we looked at the Array object in the Of a collection as a generic type that allows us to store and iterate over data. In our first lesson on collections we look at the collection interfaces and classes using various diagrams and explain the terminology used when dealing with collections.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |