lecture15

lecture15 - PIC 20A Lecture 15: Collections What is a...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
PIC 20A Lecture 15: Collections
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What is a collection? •A collection is object that groups multiple elements into a single unit. Implementations of a Collection an ArrayList •a Vector LinkedList Stack PriorityQueue TreeSet Note: An array is NOT a Collection , but may be converted to one: String[] veggies = {"carrot", "celery"}; List<String> veg = Arrays.asList(veggies) ;
Background image of page 2
More on collections Collections store, retrieve, manipulate, and communicate aggregate data. Some collections allow duplicate elements. Some collections are ordered.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
How does Java represent a collection? • Java has a unified architecture called the Java Collections Framework for representing and manipulating any collection
Background image of page 4
Anatomy of a Java Collections Framework A JCF contains the following components: • interfaces • implementations • algorithms
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Core JCF Interface Hierarchy Collection<E> Set<E> List<E> Queue<E> SortedSet<E> Map<K,V> SortedMap<K,V> All of these interfaces are generic.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 17

lecture15 - PIC 20A Lecture 15: Collections What is a...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online