Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
3rd Edition
ISBN: 9780134038179
Author: Tony Gaddis, Godfrey Muganda
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 19.1, Problem 19.5CP
Program Plan Intro
“List” interface:
- “List” is an interface which extends “Collection”. It is an ordered collection of objects in which duplicate values can be stored.
- It permits positional access and insertion of elements. It is implements by “ArrayList”, “LinkedList”, “
Vector ”, and “Stack” classes.
“Set” interface:
- “Set” is an interface which extends “Collection”. It is an unordered collection of objects in which duplicate values cannot be stored.
- It is implemented by “TreeSet”, “HashSet”, and “LinkedHashSet”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
What kinds of functions are missing from the List interface that are shared by both ArrayList and LinkedList? What leads you to believe that these approaches are not included on the List?
What are the major differences between a list and a set in Java? How can you determine when to implement a list versus a set for an application? Provide an example code segment in Java that illustrates utilizing a list or a set.
Please give a detailed answer and code examples for all of the questions below.What is an array and linked list?What the difference between array and List?Difference between ArrayList and Arrays in Java?
Chapter 19 Solutions
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Ch. 19.1 - Prob. 19.1CPCh. 19.1 - What are the three general types of collections?Ch. 19.1 - Prob. 19.3CPCh. 19.1 - Prob. 19.4CPCh. 19.1 - Prob. 19.5CPCh. 19.1 - Prob. 19.6CPCh. 19.1 - Prob. 19.7CPCh. 19.2 - Prob. 19.8CPCh. 19.2 - Prob. 19.9CPCh. 19.2 - Prob. 19.10CP
Ch. 19.2 - Prob. 19.11CPCh. 19.2 - Prob. 19.12CPCh. 19.2 - Prob. 19.13CPCh. 19.2 - Prob. 19.14CPCh. 19.2 - Prob. 19.16CPCh. 19.2 - Prob. 19.17CPCh. 19.2 - Prob. 19.18CPCh. 19.2 - Prob. 19.20CPCh. 19.3 - Prob. 19.21CPCh. 19.3 - Prob. 19.22CPCh. 19.3 - Prob. 19.23CPCh. 19.3 - Prob. 19.24CPCh. 19.3 - Any time you override the Object classs equals...Ch. 19.3 - Prob. 19.26CPCh. 19.3 - Prob. 19.27CPCh. 19.3 - Prob. 19.28CPCh. 19.4 - Prob. 19.29CPCh. 19.4 - Prob. 19.31CPCh. 19.4 - Prob. 19.32CPCh. 19.6 - How do you define a stream of elements?Ch. 19.6 - How does a stream intermediate operation differ...Ch. 19.6 - Prob. 19.35CPCh. 19.6 - Prob. 19.36CPCh. 19.6 - Prob. 19.37CPCh. 19.6 - Prob. 19.38CPCh. 19.6 - Prob. 19.39CPCh. 19 - Prob. 1MCCh. 19 - Prob. 2MCCh. 19 - This type of collection is optimized for...Ch. 19 - Prob. 4MCCh. 19 - A terminal operation in a stream pipeline is also...Ch. 19 - Prob. 6MCCh. 19 - Prob. 7MCCh. 19 - This List Iterator method replaces an existing...Ch. 19 - Prob. 9MCCh. 19 - Prob. 10MCCh. 19 - This is an object that can compare two other...Ch. 19 - This class provides numerous static methods that...Ch. 19 - Prob. 13MCCh. 19 - Prob. 14MCCh. 19 - Prob. 15TFCh. 19 - Prob. 16TFCh. 19 - Prob. 17TFCh. 19 - Prob. 18TFCh. 19 - Prob. 19TFCh. 19 - Prob. 20TFCh. 19 - Prob. 21TFCh. 19 - Prob. 22TFCh. 19 - Prob. 1FTECh. 19 - Prob. 2FTECh. 19 - Prob. 3FTECh. 19 - Prob. 4FTECh. 19 - Write a statement that declares a List reference...Ch. 19 - Prob. 2AWCh. 19 - Assume that it references a newly created iterator...Ch. 19 - Prob. 4AWCh. 19 - Prob. 2SACh. 19 - Prob. 4SACh. 19 - Prob. 5SACh. 19 - Prob. 6SACh. 19 - How does the Java compiler process an enhanced for...Ch. 19 - Prob. 8SACh. 19 - Prob. 9SACh. 19 - Prob. 10SACh. 19 - Prob. 11SACh. 19 - Prob. 12SACh. 19 - Prob. 13SACh. 19 - Prob. 14SACh. 19 - Word Set Write an application that reads a line of...Ch. 19 - Prob. 3PCCh. 19 - Prob. 5PCCh. 19 - Prob. 8PC
Knowledge Booster
Similar questions
- a. What does the function begin of the class linkedListType do?b. What does the function end of the class linkedListType do?arrow_forwardWhich methods do ArrayList and LinkedList have that are not defined in the List interface? Why do you think that these methods are not included in List?arrow_forwardWhat is the difference between Set and Map?arrow_forward
- Provide me complete and correct solution thanks 3arrow_forwardDescribe the difference between the way a class that implements the List interface stores and accesses elements and the way that aclass that implement the Map interface stores and accesses elements .arrow_forwardIn C++, Write the implementation for the methods of the Node class including the constructor. The constructor should set value to the passed in parameter, and set the value of the next pointer to NULL. getNext() should return the value of the next pointer. setNext() should set the value of the next pointer to the parameter that is passed in. In the main() function below (where it says // Step 2 code here), write the code to make a list of 10 Node objects. To do this, make a root pointer which is a pointer to a Node object, and then use a loop to create new Nodes, hooking up the list using setNext() and getNext() for each node. Set the value of each new Node to be the even numbers 2 through 18 (in addition to the root node which has value 0). Make sure that your nodes are linked together! Write code to step through your linked list (where it says // Step 3 code here), printing the value of each node. Write code to clean up the list (where it says // Step 4 code here). Print a…arrow_forward
- Your understanding of importing modules, using lists and dictionaries and creating objects from a class will be exercised in this lab. Be prepared to use your solution for the “Classes” lab (see Blackboard for the link) where you wrote the PlayingCard class. In this lab, you will have to generate a random list of PlayingCard objects for where the suit and rank combinations of each card are randomly choosen. Using this list of randomly created playing cards, you will use dictionaries and lists to store important data about these playing cards, particularly the frequency distribution of each rank-suit combination you created (e.g. like if 10 queen of hearts cards are generated and counted.) Thanks to the clearly described interface used to communicate to any PlayingCard object, specifically the get_rank() and get_suit() methods, you can just import your “Classes” lab as a module and use your previously written code! Note: You’ll definitely need to make sure your solutions work for this…arrow_forwardInstruction: To test the Linked List class, create a new Java class with the main method, generate Linked List using Integer and check whether all methods do what they’re supposed to do. A sample Java class with main method is provided below including output generated. If you encounter errors, note them and try to correct the codes. Post the changes in your code, if any. Additional Instruction: Linked List is a part of the Collection framework present in java.util package, however, to be able to check the complexity of Linked List operations, we can recode the data structure based on Java Documentation https://docs.oracle.com/javase/8/docs/api/java/util/LinkedList.html package com.linkedlist; public class linkedListTester { public static void main(String[] args) { ListI<Integer> list = new LinkedList<Integer>(); int n=10; for(int i=0;i<n;i++) { list.addFirst(i); } for(int…arrow_forwardwhat are the prerequisites of an interface and why what you explain here aligns .arrow_forward
- Please answer in Java, thank you. The purpose of this assignment is to practice your knowledge of how a linked data structure is implemented. This is a more advanced version of a linked list, and will help to give you practice in how to deal with data structures connected through references. This assignment is very important to help you understand the fundamentals of Linked Lists. At the end of this assignment, you should be able to fully understand how any variation of a Linked List is implemented. Instructions: For this project you will be implementing a new data structure called LinkedGrid. This is a linked type data structure version of a 2D array. The LinkedGrid can support any combination of dimensions (n x n, n x m, or m x n, where n > m) This data structure has a singly linked system which allows you to traverse the grid in multiple directions in addition to allowing you to retrieve specific rows and columns. The following diagram gives a rough visual of this data…arrow_forwardWrite a COMPLETE C++ code by using only #include library, Includes an explanation of the code and its working details completely. It must contain the pictures of each and every functions results. Write a menu driven program to implement the linked list that has the following operations: Insert(data) Search(key) Delete(key) Your Linked List must accommodate Trader type of data. A bloom filter that acts as a membership data structure giving a very quick heads up on search of an item. Data is key/value fields for a Trader type of data tradernumber is the key or identifying field and other data fields name and department are value fields. All these fields combine to form the data and for Search and Delete all we need from the user is the key field.arrow_forwardWhich methods from the List interface are not supported by ArrayList and LinkedList? Explain why you think such methods aren't a part of List.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education