We have now discovered the collection framework, and it's time to have a look at what we have mastered.
The collection framework is set for high-performance classes to store and manipulate groups of objects. The framework provides a unified architecture to store and manipulate the elements of a collection and hide the actual implementation.
Several collections implicitly support ordering of elements and help us to sort elements without effort. We can also sort collections by providing a collection-compare function via a Comparator or an object-compare method via the Comparable interface.
The Iterable interface defines the common behavior of all the classes in a collection framework that supports a mechanism to iterate through all the elements of a collection. The Iterator follows the fail-fast principles to immediately report whether the iterating collection was modified. If you plan to create your own implementation of the Iterable interface, you need to extend IterableBase
or IterableMixin
. BidirectionalIterator
helps to iterate over collections of elements in both directions.
The collection framework also has the List
, Map
, Queue
, and Set
classes for all occasions. LinkedList
does not extend the List
class. HashSet
, LinkedHashSet
, and SplayTreeSet
are implementations of the Set
interface. ListQueue
is the implementation of the Queue
interface. HasMap
, LinkedHasMap
, and SplayTreeMap
are implementations of the Map
interface.
The collection framework has a couple of unmodifiable implementations of known interfaces, such as UnmodifiableListView
and UnmodifiableMapView
.
Many different programs can be written in JavaScript. In the next chapter, you will learn how to communicate with them from Dart. We will shed light on how to use Dart and JavaScript together to build web applications.
18.218.212.102