1 / 7

Java Lists

Java Lists. Libraries. A library is a collection of frequently used tools to facilitate programming large applications (or other libraries) Examples you probably have seen java. Math java.util. Scanner java.util. Random Other examples Access to servers/databases Graphics Reflection.

geraldw
Télécharger la présentation

Java Lists

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. Java Lists

  2. Libraries • A library is a collection of frequently used tools to facilitate programming large applications (or other libraries) • Examples you probably have seen • java.Math • java.util.Scanner • java.util.Random • Other examples • Access to servers/databases • Graphics • Reflection

  3. Libraries “Truly knowing a language requires knowing the library” -Paraphrased from Bjarne Stroustrup “Libraries are languages” -Paraphrased from Gabriel dos Reis

  4. Summary of classes (List related) • ArrayList<E> - Resizable-array doubling (supports List) • LinkedList<E> - Doubly linked list (supports List, Deque, Stack, and Queue) • Vector<E> - Resizable-array incremental (supports List) • Stack<E> • ArrayDeque<E> - Resizable-array doubling (supports Deque, Stack, and Queue) • Others outside the scope of this course • To find how to use them, go to the Java API!

  5. Interfaces Classes

  6. Example of using arraylist<E> • Scanner s = newScanner(newFile(“numbers.txt”)); • ArrayList<Integer> numbers = newArrayList<>(); • while(s.hasNextInt()) • numbers.add(s.nextInt()); • …elsewhere… • int sum = 0; • for(int n = 0; n < numbers.size(); ++n) • sum += numbers.get(n);

  7. Problems • Linear regression. Lets help the sciences by creating a simple program for linear regression modeling. Look here for how we compute correlation coefficients.Here is experimental data. • For a given data file, find the correlation coefficient between all pairs of columns. Find the most correlated items. • I recommend trying the solve this problem for x08.txt • Lets discuss together how to break the problem down into manageable pieces.

More Related