COMP 213 Advanced Object-oriented Programming Lecture 12 Java Collections.
The Collections Framework • Unified architecture for representing and manipulating collections. • Enables collections to be manipulated independently of the details of their representation. • Based on more than a dozen collection interfaces. • Includes implementations of these interfaces and algorithms to manipulate them.
Overview A collection is an object that represents a group of objects (such as the classic Vector class). Primary advantages of a collections framework: • Reduces programming effort (provides data structures & algorithms) • Increases performance (provides high-performance implementations of data structures & algorithms) • Provides interoperability between unrelated APIs (establishes a common language to pass collections back and forth) • Fosters software reuse (provides a standard interface for collections & algorithms with which to manipulate them)
Overview A collection is an object that represents a group of objects (such as the classic Vector class). Primary advantages of a collections framework: • Reduces programming effort (provides data structures & algorithms) • Increases performance (provides high-performance implementations of data structures & algorithms) • Provides interoperability between unrelated APIs (establishes a common language to pass collections back and forth) • Fosters software reuse (provides a standard interface for collections & algorithms with which to manipulate them)
Overview A collection is an object that represents a group of objects (such as the classic Vector class). Primary advantages of a collections framework: • Reduces programming effort (provides data structures & algorithms) • Increases performance (provides high-performance implementations of data structures & algorithms) • Provides interoperability between unrelated APIs (establishes a common language to pass collections back and forth) • Fosters software reuse (provides a standard interface for collections & algorithms with which to manipulate them)
Overview A collection is an object that represents a group of objects (such as the classic Vector class). Primary advantages of a collections framework: • Reduces programming effort (provides data structures & algorithms) • Increases performance (provides high-performance implementations of data structures & algorithms) • Provides interoperability between unrelated APIs (establishes a common language to pass collections back and forth) • Fosters software reuse (provides a standard interface for collections & algorithms with which to manipulate them)
Overview A collection is an object that represents a group of objects (such as the classic Vector class). Primary advantages of a collections framework: • Reduces programming effort (provides data structures & algorithms) • Increases performance (provides high-performance implementations of data structures & algorithms) • Provides interoperability between unrelated APIs (establishes a common language to pass collections back and forth) • Fosters software reuse (provides a standard interface for collections & algorithms with which to manipulate them)
The collections framework consists of: • Collection interfaces. Represent different types of collections, such as sets, lists, and maps. These interfaces form the basis of the framework. • General-purpose implementations. Primary implementations of the collection interfaces. • Legacy implementations. The collection classes from earlier releases, Vector and Hashtable, were retrofitted to implement the collection interfaces. • Algorithms. Static methods that perform useful functions on collections, such as sorting a list. • Other implementations, e.g., Concurrent, Wrapper, Convenience, and Abstract implementations.
The collections framework consists of: • Collection interfaces. Represent different types of collections, such as sets, lists, and maps. These interfaces form the basis of the framework. • General-purpose implementations. Primary implementations of the collection interfaces. • Legacy implementations. The collection classes from earlier releases, Vector and Hashtable, were retrofitted to implement the collection interfaces. • Algorithms. Static methods that perform useful functions on collections, such as sorting a list. • Other implementations, e.g., Concurrent, Wrapper, Convenience, and Abstract implementations.
The collections framework consists of: • Collection interfaces. Represent different types of collections, such as sets, lists, and maps. These interfaces form the basis of the framework. • General-purpose implementations. Primary implementations of the collection interfaces. • Legacy implementations. The collection classes from earlier releases, Vector and Hashtable, were retrofitted to implement the collection interfaces. • Algorithms. Static methods that perform useful functions on collections, such as sorting a list. • Other implementations, e.g., Concurrent, Wrapper, Convenience, and Abstract implementations.
The collections framework consists of: • Collection interfaces. Represent different types of collections, such as sets, lists, and maps. These interfaces form the basis of the framework. • General-purpose implementations. Primary implementations of the collection interfaces. • Legacy implementations. The collection classes from earlier releases, Vector and Hashtable, were retrofitted to implement the collection interfaces. • Algorithms. Static methods that perform useful functions on collections, such as sorting a list. • Other implementations, e.g., Concurrent, Wrapper, Convenience, and Abstract implementations.
The collections framework consists of: • Collection interfaces. Represent different types of collections, such as sets, lists, and maps. These interfaces form the basis of the framework. • General-purpose implementations. Primary implementations of the collection interfaces. • Legacy implementations. The collection classes from earlier releases, Vector and Hashtable, were retrofitted to implement the collection interfaces. • Algorithms. Static methods that perform useful functions on collections, such as sorting a list. • Other implementations, e.g., Concurrent, Wrapper, Convenience, and Abstract implementations.
Collection Interfaces Divided into two groups: • java.util.Collection (the most basic interface), and • java.util.Map (not true collections, but contain collection-view operations, which enable them to be manipulated as collections.
Collection Interfaces Divided into two groups: • java.util.Collection (the most basic interface), and • java.util.Map (not true collections, but contain collection-view operations, which enable them to be manipulated as collections.
java.util.Collection • Collection - A group of objects. No assumptions are made about the order of the collection (if any) or whether it can contain duplicate elements. • Set -The familiar set abstraction. No duplicate elements permitted. May or may not be ordered. • SortedSet - A set whose elements are automatically sorted, either in their natural ordering or by a comparator provided when a SortedSet instance is created. • List - Ordered collection, also known as a sequence. Duplicates are generally permitted. Allows positional access. • Queue - A collection designed for holding elements before processing. Besides basic Collection operations, queues provide additional insertion, extraction, and inspection operations. • Deque - A double ended queue, supporting element insertion and removal at both ends.
java.util.Collection • Collection - A group of objects. No assumptions are made about the order of the collection (if any) or whether it can contain duplicate elements. • Set -The familiar set abstraction. No duplicate elements permitted. May or may not be ordered. • SortedSet - A set whose elements are automatically sorted, either in their natural ordering or by a comparator provided when a SortedSet instance is created. • List - Ordered collection, also known as a sequence. Duplicates are generally permitted. Allows positional access. • Queue - A collection designed for holding elements before processing. Besides basic Collection operations, queues provide additional insertion, extraction, and inspection operations. • Deque - A double ended queue, supporting element insertion and removal at both ends.
java.util.Collection • Collection - A group of objects. No assumptions are made about the order of the collection (if any) or whether it can contain duplicate elements. • Set -The familiar set abstraction. No duplicate elements permitted. May or may not be ordered. • SortedSet - A set whose elements are automatically sorted, either in their natural ordering or by a comparator provided when a SortedSet instance is created. • List - Ordered collection, also known as a sequence. Duplicates are generally permitted. Allows positional access. • Queue - A collection designed for holding elements before processing. Besides basic Collection operations, queues provide additional insertion, extraction, and inspection operations. • Deque - A double ended queue, supporting element insertion and removal at both ends.
Recommend
More recommend