SlideShare a Scribd company logo
1 of 2
The following class stores a list of integer values and contains a method to return the smallest
value in a non-empty list. Make changes and cross out old code as needed to turn this into a
generic class that can be used to store lists of any element type E as long as those elements can
be compared for ordering (i.e., any type E whose elements support the compareTo method). You
can assume the code is adequate otherwise – you don’t need to, for example, add
additional tests to guard against null values.
public class MinList f List items; ** Construct new empty list*/ public MinList () { items = new
ArrayList ( ); } *add new item x to list * public void add(int x) items.add(x); /** return smallest
value in a non-empty list* public int minItem() assert items.size)> e; int minValue-items.get (0);
for (int val: items) if (val
Solution
import java.util.ArrayList;
public class MinList<E extends Comparable<E>> {
ArrayList<E> items;
public MinList(){
items = new ArrayList<E>();
}
public void add(E x){
items.add(x);
}
public E minItem(){
assert items.size()>0;
E minValue = items.get(0);
for(E val:items){
if(val.compareTo(minValue) < 0){
minValue = val;
}
}
return minValue;
}
}

More Related Content

Similar to The following class stores a list of integer values and contains a met.docx

Objective The purpose of this exercise is to create a Linke.pdf
Objective The purpose of this exercise is to create a Linke.pdfObjective The purpose of this exercise is to create a Linke.pdf
Objective The purpose of this exercise is to create a Linke.pdfgiriraj65
 
Lecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxLecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxSHIVA101531
 
In this assignment you will implement insert() method for a singly l.pdf
In this assignment you will implement insert() method for a singly l.pdfIn this assignment you will implement insert() method for a singly l.pdf
In this assignment you will implement insert() method for a singly l.pdffantasiatheoutofthef
 
Objective The purpose of this exercise is to create a Linked List d.pdf
Objective The purpose of this exercise is to create a Linked List d.pdfObjective The purpose of this exercise is to create a Linked List d.pdf
Objective The purpose of this exercise is to create a Linked List d.pdfaliracreations
 
Please and Thank youObjective The purpose of this exercise is to .pdf
Please and Thank youObjective The purpose of this exercise is to .pdfPlease and Thank youObjective The purpose of this exercise is to .pdf
Please and Thank youObjective The purpose of this exercise is to .pdfalicesilverblr
 
There are a couple of new methods that you will be writing for this pr.pdf
There are a couple of new methods that you will be writing for this pr.pdfThere are a couple of new methods that you will be writing for this pr.pdf
There are a couple of new methods that you will be writing for this pr.pdfaamousnowov
 
you will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfyou will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfclearvisioneyecareno
 
Write a java class LIST that outputsmainpublic class Ass.pdf
Write a java class LIST that outputsmainpublic class Ass.pdfWrite a java class LIST that outputsmainpublic class Ass.pdf
Write a java class LIST that outputsmainpublic class Ass.pdfebrahimbadushata00
 
BackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfBackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfmayorothenguyenhob69
 
Please add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docxPlease add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docxStewartt0kJohnstonh
 
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdfImplement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdfrishabjain5053
 
For this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdfFor this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdffashiongallery1
 
I only need help with four methods in the EmployeeManager class the .pdf
I only need help with four methods in the EmployeeManager class the .pdfI only need help with four methods in the EmployeeManager class the .pdf
I only need help with four methods in the EmployeeManager class the .pdfarpitcomputronics
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfinfo430661
 
Write a method expand that could be added to the LinkedlntList class f.docx
Write a method expand that could be added to the LinkedlntList class f.docxWrite a method expand that could be added to the LinkedlntList class f.docx
Write a method expand that could be added to the LinkedlntList class f.docxnoreendchesterton753
 
Write a method expand that could be added to the LinkedlntList class .docx
 Write a method expand that could be added to the LinkedlntList class .docx Write a method expand that could be added to the LinkedlntList class .docx
Write a method expand that could be added to the LinkedlntList class .docxajoy21
 

Similar to The following class stores a list of integer values and contains a met.docx (20)

Objective The purpose of this exercise is to create a Linke.pdf
Objective The purpose of this exercise is to create a Linke.pdfObjective The purpose of this exercise is to create a Linke.pdf
Objective The purpose of this exercise is to create a Linke.pdf
 
Lecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docxLecture 18Dynamic Data Structures and Generics (II).docx
Lecture 18Dynamic Data Structures and Generics (II).docx
 
In this assignment you will implement insert() method for a singly l.pdf
In this assignment you will implement insert() method for a singly l.pdfIn this assignment you will implement insert() method for a singly l.pdf
In this assignment you will implement insert() method for a singly l.pdf
 
Objective The purpose of this exercise is to create a Linked List d.pdf
Objective The purpose of this exercise is to create a Linked List d.pdfObjective The purpose of this exercise is to create a Linked List d.pdf
Objective The purpose of this exercise is to create a Linked List d.pdf
 
Please and Thank youObjective The purpose of this exercise is to .pdf
Please and Thank youObjective The purpose of this exercise is to .pdfPlease and Thank youObjective The purpose of this exercise is to .pdf
Please and Thank youObjective The purpose of this exercise is to .pdf
 
There are a couple of new methods that you will be writing for this pr.pdf
There are a couple of new methods that you will be writing for this pr.pdfThere are a couple of new methods that you will be writing for this pr.pdf
There are a couple of new methods that you will be writing for this pr.pdf
 
you will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdfyou will implement some sorting algorithms for arrays and linked lis.pdf
you will implement some sorting algorithms for arrays and linked lis.pdf
 
Array list(1)
Array list(1)Array list(1)
Array list(1)
 
javacollections.pdf
javacollections.pdfjavacollections.pdf
javacollections.pdf
 
Write a java class LIST that outputsmainpublic class Ass.pdf
Write a java class LIST that outputsmainpublic class Ass.pdfWrite a java class LIST that outputsmainpublic class Ass.pdf
Write a java class LIST that outputsmainpublic class Ass.pdf
 
BackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfBackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdf
 
Please add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docxPlease add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docx
 
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdfImplement the interface you wrote for Lab B (EntryWayListInterface)..pdf
Implement the interface you wrote for Lab B (EntryWayListInterface)..pdf
 
For this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdfFor this lab you will complete the class MyArrayList by implementing.pdf
For this lab you will complete the class MyArrayList by implementing.pdf
 
I only need help with four methods in the EmployeeManager class the .pdf
I only need help with four methods in the EmployeeManager class the .pdfI only need help with four methods in the EmployeeManager class the .pdf
I only need help with four methods in the EmployeeManager class the .pdf
 
3.ppt
3.ppt3.ppt
3.ppt
 
3.ppt
3.ppt3.ppt
3.ppt
 
Given below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdfGiven below is the completed implementation of MyLinkedList class. O.pdf
Given below is the completed implementation of MyLinkedList class. O.pdf
 
Write a method expand that could be added to the LinkedlntList class f.docx
Write a method expand that could be added to the LinkedlntList class f.docxWrite a method expand that could be added to the LinkedlntList class f.docx
Write a method expand that could be added to the LinkedlntList class f.docx
 
Write a method expand that could be added to the LinkedlntList class .docx
 Write a method expand that could be added to the LinkedlntList class .docx Write a method expand that could be added to the LinkedlntList class .docx
Write a method expand that could be added to the LinkedlntList class .docx
 

More from carold11

The Financial Management Decision Process What are the three types of.docx
The Financial Management Decision Process What are the three types of.docxThe Financial Management Decision Process What are the three types of.docx
The Financial Management Decision Process What are the three types of.docxcarold11
 
The Federal Reserve attempts to keep prices stable and unemployment lo.docx
The Federal Reserve attempts to keep prices stable and unemployment lo.docxThe Federal Reserve attempts to keep prices stable and unemployment lo.docx
The Federal Reserve attempts to keep prices stable and unemployment lo.docxcarold11
 
The following accounts were taken from ABC CompanySolutionCalculation.docx
The following accounts were taken from ABC CompanySolutionCalculation.docxThe following accounts were taken from ABC CompanySolutionCalculation.docx
The following accounts were taken from ABC CompanySolutionCalculation.docxcarold11
 
The following are key terms in Chapter 14 that relate to regulatory an.docx
The following are key terms in Chapter 14 that relate to regulatory an.docxThe following are key terms in Chapter 14 that relate to regulatory an.docx
The following are key terms in Chapter 14 that relate to regulatory an.docxcarold11
 
The following account balances relate to the stockholders equity accou.docx
The following account balances relate to the stockholders equity accou.docxThe following account balances relate to the stockholders equity accou.docx
The following account balances relate to the stockholders equity accou.docxcarold11
 
The following accounts were taken from ABC CompanySolutionCalculation (3).docx
The following accounts were taken from ABC CompanySolutionCalculation (3).docxThe following accounts were taken from ABC CompanySolutionCalculation (3).docx
The following accounts were taken from ABC CompanySolutionCalculation (3).docxcarold11
 
The following accounts were taken from ABC CompanySolutionCalculation (2).docx
The following accounts were taken from ABC CompanySolutionCalculation (2).docxThe following accounts were taken from ABC CompanySolutionCalculation (2).docx
The following accounts were taken from ABC CompanySolutionCalculation (2).docxcarold11
 
The following accounts were taken from ABC CompanySolutionCalculation (1).docx
The following accounts were taken from ABC CompanySolutionCalculation (1).docxThe following accounts were taken from ABC CompanySolutionCalculation (1).docx
The following accounts were taken from ABC CompanySolutionCalculation (1).docxcarold11
 
The fiscal 2012 financial statements of Barney Services shows average.docx
The fiscal 2012 financial statements of Barney Services shows average.docxThe fiscal 2012 financial statements of Barney Services shows average.docx
The fiscal 2012 financial statements of Barney Services shows average.docxcarold11
 
The equity sections from Atticus Group The equity sections from.docx
The equity sections from Atticus Group        The equity sections from.docxThe equity sections from Atticus Group        The equity sections from.docx
The equity sections from Atticus Group The equity sections from.docxcarold11
 
The executive officers of Rouse Corporation have a performance-based c.docx
The executive officers of Rouse Corporation have a performance-based c.docxThe executive officers of Rouse Corporation have a performance-based c.docx
The executive officers of Rouse Corporation have a performance-based c.docxcarold11
 
The Federal Reserve had to resort to non-standard methods to try to st.docx
The Federal Reserve had to resort to non-standard methods to try to st.docxThe Federal Reserve had to resort to non-standard methods to try to st.docx
The Federal Reserve had to resort to non-standard methods to try to st.docxcarold11
 
The EU recently admitted the Eastern European countries- How do you as.docx
The EU recently admitted the Eastern European countries- How do you as.docxThe EU recently admitted the Eastern European countries- How do you as.docx
The EU recently admitted the Eastern European countries- How do you as.docxcarold11
 
The Esposito Import Company had 1 million shares of common stock outst.docx
The Esposito Import Company had 1 million shares of common stock outst.docxThe Esposito Import Company had 1 million shares of common stock outst.docx
The Esposito Import Company had 1 million shares of common stock outst.docxcarold11
 
The energy levels of electrons are related to their- a) Position on t.docx
The energy levels of electrons are related to their-  a) Position on t.docxThe energy levels of electrons are related to their-  a) Position on t.docx
The energy levels of electrons are related to their- a) Position on t.docxcarold11
 
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docx
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docxThe Electron in a Hydrogen Atom transforms from its n-1 state to its n.docx
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docxcarold11
 
The enqueue operation on the Queue ADT adds a new item to the back of (1).docx
The enqueue operation on the Queue ADT adds a new item to the back of (1).docxThe enqueue operation on the Queue ADT adds a new item to the back of (1).docx
The enqueue operation on the Queue ADT adds a new item to the back of (1).docxcarold11
 
The Fed follows the theory of bureaucratic behavior in what sense-.docx
The Fed follows the theory of bureaucratic behavior in what sense-.docxThe Fed follows the theory of bureaucratic behavior in what sense-.docx
The Fed follows the theory of bureaucratic behavior in what sense-.docxcarold11
 
Pay structures Union contracts Wage and price contracts Levels of reve.docx
Pay structures Union contracts Wage and price contracts Levels of reve.docxPay structures Union contracts Wage and price contracts Levels of reve.docx
Pay structures Union contracts Wage and price contracts Levels of reve.docxcarold11
 
Pat ts oints Give all answers to the corret number of significant figu.docx
Pat ts oints Give all answers to the corret number of significant figu.docxPat ts oints Give all answers to the corret number of significant figu.docx
Pat ts oints Give all answers to the corret number of significant figu.docxcarold11
 

More from carold11 (20)

The Financial Management Decision Process What are the three types of.docx
The Financial Management Decision Process What are the three types of.docxThe Financial Management Decision Process What are the three types of.docx
The Financial Management Decision Process What are the three types of.docx
 
The Federal Reserve attempts to keep prices stable and unemployment lo.docx
The Federal Reserve attempts to keep prices stable and unemployment lo.docxThe Federal Reserve attempts to keep prices stable and unemployment lo.docx
The Federal Reserve attempts to keep prices stable and unemployment lo.docx
 
The following accounts were taken from ABC CompanySolutionCalculation.docx
The following accounts were taken from ABC CompanySolutionCalculation.docxThe following accounts were taken from ABC CompanySolutionCalculation.docx
The following accounts were taken from ABC CompanySolutionCalculation.docx
 
The following are key terms in Chapter 14 that relate to regulatory an.docx
The following are key terms in Chapter 14 that relate to regulatory an.docxThe following are key terms in Chapter 14 that relate to regulatory an.docx
The following are key terms in Chapter 14 that relate to regulatory an.docx
 
The following account balances relate to the stockholders equity accou.docx
The following account balances relate to the stockholders equity accou.docxThe following account balances relate to the stockholders equity accou.docx
The following account balances relate to the stockholders equity accou.docx
 
The following accounts were taken from ABC CompanySolutionCalculation (3).docx
The following accounts were taken from ABC CompanySolutionCalculation (3).docxThe following accounts were taken from ABC CompanySolutionCalculation (3).docx
The following accounts were taken from ABC CompanySolutionCalculation (3).docx
 
The following accounts were taken from ABC CompanySolutionCalculation (2).docx
The following accounts were taken from ABC CompanySolutionCalculation (2).docxThe following accounts were taken from ABC CompanySolutionCalculation (2).docx
The following accounts were taken from ABC CompanySolutionCalculation (2).docx
 
The following accounts were taken from ABC CompanySolutionCalculation (1).docx
The following accounts were taken from ABC CompanySolutionCalculation (1).docxThe following accounts were taken from ABC CompanySolutionCalculation (1).docx
The following accounts were taken from ABC CompanySolutionCalculation (1).docx
 
The fiscal 2012 financial statements of Barney Services shows average.docx
The fiscal 2012 financial statements of Barney Services shows average.docxThe fiscal 2012 financial statements of Barney Services shows average.docx
The fiscal 2012 financial statements of Barney Services shows average.docx
 
The equity sections from Atticus Group The equity sections from.docx
The equity sections from Atticus Group        The equity sections from.docxThe equity sections from Atticus Group        The equity sections from.docx
The equity sections from Atticus Group The equity sections from.docx
 
The executive officers of Rouse Corporation have a performance-based c.docx
The executive officers of Rouse Corporation have a performance-based c.docxThe executive officers of Rouse Corporation have a performance-based c.docx
The executive officers of Rouse Corporation have a performance-based c.docx
 
The Federal Reserve had to resort to non-standard methods to try to st.docx
The Federal Reserve had to resort to non-standard methods to try to st.docxThe Federal Reserve had to resort to non-standard methods to try to st.docx
The Federal Reserve had to resort to non-standard methods to try to st.docx
 
The EU recently admitted the Eastern European countries- How do you as.docx
The EU recently admitted the Eastern European countries- How do you as.docxThe EU recently admitted the Eastern European countries- How do you as.docx
The EU recently admitted the Eastern European countries- How do you as.docx
 
The Esposito Import Company had 1 million shares of common stock outst.docx
The Esposito Import Company had 1 million shares of common stock outst.docxThe Esposito Import Company had 1 million shares of common stock outst.docx
The Esposito Import Company had 1 million shares of common stock outst.docx
 
The energy levels of electrons are related to their- a) Position on t.docx
The energy levels of electrons are related to their-  a) Position on t.docxThe energy levels of electrons are related to their-  a) Position on t.docx
The energy levels of electrons are related to their- a) Position on t.docx
 
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docx
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docxThe Electron in a Hydrogen Atom transforms from its n-1 state to its n.docx
The Electron in a Hydrogen Atom transforms from its n-1 state to its n.docx
 
The enqueue operation on the Queue ADT adds a new item to the back of (1).docx
The enqueue operation on the Queue ADT adds a new item to the back of (1).docxThe enqueue operation on the Queue ADT adds a new item to the back of (1).docx
The enqueue operation on the Queue ADT adds a new item to the back of (1).docx
 
The Fed follows the theory of bureaucratic behavior in what sense-.docx
The Fed follows the theory of bureaucratic behavior in what sense-.docxThe Fed follows the theory of bureaucratic behavior in what sense-.docx
The Fed follows the theory of bureaucratic behavior in what sense-.docx
 
Pay structures Union contracts Wage and price contracts Levels of reve.docx
Pay structures Union contracts Wage and price contracts Levels of reve.docxPay structures Union contracts Wage and price contracts Levels of reve.docx
Pay structures Union contracts Wage and price contracts Levels of reve.docx
 
Pat ts oints Give all answers to the corret number of significant figu.docx
Pat ts oints Give all answers to the corret number of significant figu.docxPat ts oints Give all answers to the corret number of significant figu.docx
Pat ts oints Give all answers to the corret number of significant figu.docx
 

Recently uploaded

Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Recently uploaded (20)

Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

The following class stores a list of integer values and contains a met.docx

  • 1. The following class stores a list of integer values and contains a method to return the smallest value in a non-empty list. Make changes and cross out old code as needed to turn this into a generic class that can be used to store lists of any element type E as long as those elements can be compared for ordering (i.e., any type E whose elements support the compareTo method). You can assume the code is adequate otherwise – you don’t need to, for example, add additional tests to guard against null values. public class MinList f List items; ** Construct new empty list*/ public MinList () { items = new ArrayList ( ); } *add new item x to list * public void add(int x) items.add(x); /** return smallest value in a non-empty list* public int minItem() assert items.size)> e; int minValue-items.get (0); for (int val: items) if (val Solution import java.util.ArrayList; public class MinList<E extends Comparable<E>> { ArrayList<E> items; public MinList(){ items = new ArrayList<E>(); } public void add(E x){ items.add(x); } public E minItem(){ assert items.size()>0; E minValue = items.get(0); for(E val:items){ if(val.compareTo(minValue) < 0){ minValue = val; }