15CollectionsSmall

15CollectionsSmall - Lecture Set #15: Collections 1. 1. 2....

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

View Full Document Right Arrow Icon
1 CMSC 131 Fal 2009 Jan Plane (adapted from Bonnie Dorr) Lecture Set #15: Collections 1. Collections 1. ArrayList 2. Stack 2. New Looping construct 1. for each loop CMSC 131 Fal 2009 Jan Plane (adapted from Bonnie Dorr) 1 Collections in Java c Arrays are collections c Arrays are objects c Arrays are sequences of elements in base type c These elements are collected together in one object: the array c Java includes may other collection mechanisms c Arrays good for some applications (fixed-length sequences), not others (varying-length sequences) c Other collections tuned for different purposes c General observation holds, however: c Collections are objects … c … that contain other objects in a given type c We’ll study two (more in CMSC132): Stack, ArrayList CMSC 131 Fal 2009 Jan Plane (adapted from Bonnie Dorr) 2 ArrayList Collection c Like arrays … but support for inserting/deleting new elements c Sequences of elements c All elements must be in same (base) type c Syntax: ArrayList<E>
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/04/2011 for the course CMSC 131 taught by Professor Plane during the Fall '08 term at Maryland.

Page1 / 3

15CollectionsSmall - Lecture Set #15: Collections 1. 1. 2....

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

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