Join Peggy Fisher for an in-depth discussion in this video Managing ArrayLists, part of Java Essential Training for Students.
- View Offline
- Exercise Files
- The last type arrays that we're gonna talk about…is an ArrayLists.…There are several important differences…between an ArrayList and an array.…An ArrayList can only hold objects,…such as Strings.…When using an ArrayList,…you can increase and decrease the size dynamically.…To access the elements in an ArrayList,…we use the .get method,…and to update elements in an ArrayList,…we use the .set method.…If we wanna add an element,…we just use the .add element.…
We don't have to worry about the size of the ArrayList,…it'll automatically grow as we need it to.…And if you wanna take away an element,…or delete an element, you can use the .remove method.…Remember our pizza shop?…We mentioned that it might be nice to keep track…of more than one pizza at a time.…So let's see what happens when use…an ArrayList to hold our pizza objects.…Here's the main program for the PizzaShop.…At the top, I've already gone ahead…and imported the java.util.ArrayList;.…I'm gonna scroll down a little bit,…what we'll do is we'll add a while loop,…
- Getting started with parsing
- Reviewing data types
- Using decisions
- Creating user-defined methods
- Command-line debugging
- Exploring the Java API
- Creating and instantiating classes
- Working with interfaces
- Storing items with arrays
Skill Level Intermediate
1. Command Level Programming
2. Basics Review
4. Java API
5. Simulations and Algorithm Analysis
6. Classes and Objects
7. More on Classes
8. Data Structures
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.