ListInterface

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

in java please

Create a method for the client perspective to determine if a ListInterface has the same numbers in the same order. 

method header:

public static boolean equivalentLists(ListInterface<Integer> numberListInterface, List<Integer> numberList)

1
public interface ListInterface<T>
2
/ ** Adds a new entry to the end of this list.
Entries currently in the list are unaffected.
The list's size is increased by 1.
@param newEntry The object to be added as a new entry. */
public void add(T newEntry);
4
7
/ ** Adds a new entry at a specified position within this list.
Entries originally at and above the specified position
are at the next higher position within the list.
The list's size is increased by 1.
@param newPosition
9.
10
11
12
An integer that specifies the desired
position of the new entry.
The object to be added as a new entry.
13
14
@param newEntry
@throws
15
IndexOut0fBoundsException if either
newPosition < 1 or newPosition > getLength() + 1. */
16
17
18
public void add(int newPosition, T newEntry);
19
/ ** Removes the entry at a given position from this list.
Entries originally at positions higher than the given
position are at the next lower position within the list,
and the list's size is decreased by 1.
@param givenPosition An integer that indicates the position of
20
21
22
23
24
the entry to be removed.
A reference to the removed entry.
25
26
@return
27
@throws IndexOut0fBoundsException if either
28
givenPosition < 1 or givenPosition > getLength(). */
29
public T remove(int givenPosition);
30
/ ** Removes all entries from this list. */
public void clear();
31
32
33
/ ** Replaces the entry at a given position in this list.
@param givenPosition An integer that indicates the position of
|||||| the entry to be replaced.
@param newEntry The object that will replace the entry at the
position givenPosition.
The original entry that was replaced.
34
35
36
37
38
39
@return
40
@throws Index0ut0fBoundsException if either
41
givenPosition < 1 or givenPosition > getLength(). */
42
public T replace(int givenPosition, T newEntry);
43
/ ** Retrieves the entry at a given position in this list.
@param givenPosition An integer that indicates the position of
| I| the desired entry.
44
45
46
47
@return
A reference to the indicated entry.
48
@throws IndexOut0fBoundsException if either
49
givenPosition < 1 or givenPosition >
getLength(). */
50
public T getEntry(int givenPosition);
51
/ ** Retrieves all entries that are in this list in the order in which
they occur in the list.
@return A newly allocated array of all the entries in the list.
If the list is empty, the returned array is empty. */
52
53
54
55
56
public T[] toArray();
57
/ ** Sees whether this list contains a given entry.
@param anEntry The object that is the desired entry.
@return True if the list contains anEntry, or false if not. */
public boolean contains(T anEntry);
58
59
60
61
62
/ ** Gets the length of this list.
@return The integer number of entries currently in the list. */
public int getLength();
63
64
65
66
/ ** Sees whether this list is empty.
@return True if the list is empty, or false if not. */
public boolean isEmpty();
} // end ListInterface
67
68
69
70
71
Line 1, Column 1
Transcribed Image Text:1 public interface ListInterface<T> 2 / ** Adds a new entry to the end of this list. Entries currently in the list are unaffected. The list's size is increased by 1. @param newEntry The object to be added as a new entry. */ public void add(T newEntry); 4 7 / ** Adds a new entry at a specified position within this list. Entries originally at and above the specified position are at the next higher position within the list. The list's size is increased by 1. @param newPosition 9. 10 11 12 An integer that specifies the desired position of the new entry. The object to be added as a new entry. 13 14 @param newEntry @throws 15 IndexOut0fBoundsException if either newPosition < 1 or newPosition > getLength() + 1. */ 16 17 18 public void add(int newPosition, T newEntry); 19 / ** Removes the entry at a given position from this list. Entries originally at positions higher than the given position are at the next lower position within the list, and the list's size is decreased by 1. @param givenPosition An integer that indicates the position of 20 21 22 23 24 the entry to be removed. A reference to the removed entry. 25 26 @return 27 @throws IndexOut0fBoundsException if either 28 givenPosition < 1 or givenPosition > getLength(). */ 29 public T remove(int givenPosition); 30 / ** Removes all entries from this list. */ public void clear(); 31 32 33 / ** Replaces the entry at a given position in this list. @param givenPosition An integer that indicates the position of |||||| the entry to be replaced. @param newEntry The object that will replace the entry at the position givenPosition. The original entry that was replaced. 34 35 36 37 38 39 @return 40 @throws Index0ut0fBoundsException if either 41 givenPosition < 1 or givenPosition > getLength(). */ 42 public T replace(int givenPosition, T newEntry); 43 / ** Retrieves the entry at a given position in this list. @param givenPosition An integer that indicates the position of | I| the desired entry. 44 45 46 47 @return A reference to the indicated entry. 48 @throws IndexOut0fBoundsException if either 49 givenPosition < 1 or givenPosition > getLength(). */ 50 public T getEntry(int givenPosition); 51 / ** Retrieves all entries that are in this list in the order in which they occur in the list. @return A newly allocated array of all the entries in the list. If the list is empty, the returned array is empty. */ 52 53 54 55 56 public T[] toArray(); 57 / ** Sees whether this list contains a given entry. @param anEntry The object that is the desired entry. @return True if the list contains anEntry, or false if not. */ public boolean contains(T anEntry); 58 59 60 61 62 / ** Gets the length of this list. @return The integer number of entries currently in the list. */ public int getLength(); 63 64 65 66 / ** Sees whether this list is empty. @return True if the list is empty, or false if not. */ public boolean isEmpty(); } // end ListInterface 67 68 69 70 71 Line 1, Column 1
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
List
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education