1 / 9

Java Arrays and Array Lists Overview

Learn about arrays and array lists in Java, including their features, declarations, storage, and manipulation methods. Understand the differences between fixed-length arrays and resizable array lists. Explore sorting, searching, copying, and comparing techniques for efficient data handling.

ifink
Download Presentation

Java Arrays and Array Lists Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Arrays and Array lists Drew Alvarez and cordie Goodrich

  2. Arrays • Container object • Fixed length • Composed of elements of a single type • Sorted by numerical indices starting with 0 • Part of core java programming • Primitives or objects

  3. Arrays • Storing and organization of values • Declaration: • int[] myArray= new int[3]; • myArray[0] = 5; • myArray[1] = 10; • myArray[2] = 15; • Searching, Copying, Comparing

  4. Arrays 1 4 0 2 3

  5. Array List • Adjustable size • Adjustment takes time • Element of different types • Cannot store primitives • Collections Framework

  6. Array List • Storing and organization of values • + ability to add or remove • Need “import java.util.ArrayList;” • Declaration: • ArrayList<String> list = new ArrayList<String>() • Adjustment: • list.add(“x”); • list.remove(“x”); • Clear, Clone, Capacity adjustments

  7. Array Lists

  8. review

  9. Sources • http://docs.oracle.com/javase/8/docs/api/java/util/Arrays.html • http://java67.blogspot.com/2012/12/difference-between-array-vs-arraylist-java.htm • http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html • http://docs.oracle.com/javase/8/docs/technotes/guides/collections/overview.html • http://stackoverflow.com/questions/1200621/how-to-declare-an-array-in-java • http://www.java-samples.com/showtutorial.php?tutorialid=234 • http://stackoverflow.com/questions/1005073/initialization-of-an-arraylist-in-one-line • http://www.roseindia.net/java/beginners/array_list_demo.shtmlhttp://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/java/nutsandbolts/examples/ArrayDemo.java

More Related