SlideShare ist ein Scribd-Unternehmen logo
1 von 2
Downloaden Sie, um offline zu lesen
Note: Help with methods public boolean remove(Object o), public boolean
addAll(CiscCollection extends E> c), public Iterator iterator(), public Object[] toArray(), and
public void clear(). package edu.ust.cisc; import java.util.*; public class CiscStack implements
CiscCollection { /** * A reference to the node containing the element at the top of the stack (or
null if stack is empty). */ private Node top; /** * Number of elements in the stack. */ private int
size; /** * Inserts the specified item at the top of the stack. * * * @param item element being
added to the stack * @throws NullPointerException if the item is null */ public void push(E
item) { } /** * Returns and removes the element at the top of the stack. After this method
finishes, {@code top} should refer to * the node containing the most recently added element (or
null if no more elements remain in the stack). * * * @return the element at the top of the stack *
@throws EmptyStackException if the stack is empty */ public E pop() { return null; } /** * *
@return the element at the top of the stack * @throws EmptyStackException if the stack is
empty */ public E peek() { return null; } /** * Returns the number of elements in this stack. * *
@return the number of elements in this stack */ @Override public int size() { return 0; } /** *
Returns {@code true} if this stack contains no elements. * * @return {@code true} if this stack
contains no elements */ @Override public boolean isEmpty() { return false; } /** * Returns
{@code true} if this stack contains the specified element (compared using the {@code equals} *
method). * * @param o element whose presence in this stack is to be tested * @return {@code
true} if this stack contains the specified element * @throws NullPointerException if the
specified element is null */ @Override public boolean contains(Object o) { if(o==null){ throw
new NullPointerException(); } Node node = top; while(node!=null) { if (node.data.equals(o)) {
return true; } node = node.next; } return false; } /** * Inserts the specified item at the top of the
stack. See the {@code push} operation. * * @param e element being added to the stack *
@return {@code true} * @throws NullPointerException if the item is null */ @Override public
boolean add(E e) { return false; } /** * This operation is not supported by CiscStack. * *
@param o element to be removed from this collection, if present * @return {@code true} if this
collection contained the specified element * @throws UnsupportedOperationException if the
{@code remove} operation is not supported by this collection */ @Override public boolean
remove(Object o) { return false; } /** * Adds all elements in the specified collection to this
stack, in the order that they are returned by the * specified collection's iterator. * * @param c
collection containing elements to be added to this stack * @return {@code true} if this stack
changed as a result of the call * @throws NullPointerException if the specified collection is null
*/ @Override public boolean addAll(CiscCollection extends E> c) { return false; } /** * Returns
an iterator over the elements in this stack from top to bottom. * * @return an iterator over the
elements in this stack from top to bottom */ @Override public Iterator iterator() { return null; }
/** * Returns an array containing all of the elements in this stack in proper sequence (from top to
bottom). * *
The returned array will be "safe" in that no references to it are maintained by this stack. The
caller is * thus free to modify the returned array. * * @return an array containing all of the
elements in this stack in proper sequence */ @Override public Object[] toArray() { return new
Object[0]; } /** * Removes all of the elements from this stack. The stack will be empty after this
call returns. */ @Override public void clear() { } /** * Returns a string representation of this
stack. This string should consist of a comma separated list of * values contained in this stack,
from top to bottom, surrounded by square brackets (examples: [3, 6, 7] and []). * * @return a
string representation of this stack */ public String toString() { return null; } private static class
Node { private E data; private Node next; private Node(E data, Node next) { this.data = data;
this.next = next; } } private static class CiscStackIterator implements Iterator { /** * A reference
to the node containing the next element to return. */ private Node nextNode; /** * Constructs an
iterator beginning at the specified node. */ private CiscStackIterator(Node top) { } /** * Returns
{@code true} if the iteration has more elements. (In other words, returns {@code true} if *
{@link #next} would return an element rather than throwing an exception.) * * @return {@code
true} if the iteration has more elements */ @Override public boolean hasNext() { return false; }
/** * Returns the next element in the iteration. * * @return the next element in the iteration *
@throws NoSuchElementException if the iteration has no more elements */ @Override public E
next() { return null; } } }

Weitere ähnliche Inhalte

Ähnlich wie Note- Help with methods public boolean remove(Object o)- public boolea.pdf

Please help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdfPlease help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdf
seoagam1
 
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdfLabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
fantasiatheoutofthef
 
Given the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docxGiven the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docx
shericehewat
 
A linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdfA linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdf
kisgstin23
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdf
ravikapoorindia
 
1 The goal is to implement DataStructuresArrayStack accor.pdf
1 The goal is to implement DataStructuresArrayStack accor.pdf1 The goal is to implement DataStructuresArrayStack accor.pdf
1 The goal is to implement DataStructuresArrayStack accor.pdf
saradashata
 
@author Derek Harter @cwid 123 45 678 @class .docx
@author Derek Harter  @cwid   123 45 678  @class  .docx@author Derek Harter  @cwid   123 45 678  @class  .docx
@author Derek Harter @cwid 123 45 678 @class .docx
adkinspaige22
 
STAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdfSTAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdf
babitasingh698417
 
So I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdfSo I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdf
aksahnan
 
Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdf
annaelctronics
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
Conint29
 
StackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdf
ARCHANASTOREKOTA
 
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
mail931892
 
Implementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdfImplementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdf
maheshkumar12354
 
Everything needs to be according to the instructions- thank you! SUPPO.pdf
Everything needs to be according to the instructions- thank you! SUPPO.pdfEverything needs to be according to the instructions- thank you! SUPPO.pdf
Everything needs to be according to the instructions- thank you! SUPPO.pdf
firstchoiceajmer
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
siennatimbok52331
 

Ähnlich wie Note- Help with methods public boolean remove(Object o)- public boolea.pdf (20)

Please help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdfPlease help me to make a programming project I have to sue them today- (1).pdf
Please help me to make a programming project I have to sue them today- (1).pdf
 
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdfLabProgram.javaimport java.util.NoSuchElementException;public .pdf
LabProgram.javaimport java.util.NoSuchElementException;public .pdf
 
(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manual(674335607) cs2309 java-lab-manual
(674335607) cs2309 java-lab-manual
 
Given the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docxGiven the following ADT definition of a stack to use stack .docx
Given the following ADT definition of a stack to use stack .docx
 
A linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdfA linked stack is implemented using a standard Node class as follows.pdf
A linked stack is implemented using a standard Node class as follows.pdf
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdf
 
1 The goal is to implement DataStructuresArrayStack accor.pdf
1 The goal is to implement DataStructuresArrayStack accor.pdf1 The goal is to implement DataStructuresArrayStack accor.pdf
1 The goal is to implement DataStructuresArrayStack accor.pdf
 
@author Derek Harter @cwid 123 45 678 @class .docx
@author Derek Harter  @cwid   123 45 678  @class  .docx@author Derek Harter  @cwid   123 45 678  @class  .docx
@author Derek Harter @cwid 123 45 678 @class .docx
 
Posfix
PosfixPosfix
Posfix
 
STAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdfSTAGE 2 The Methods 65 points Implement all the methods t.pdf
STAGE 2 The Methods 65 points Implement all the methods t.pdf
 
Please review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdfPlease review my code (java)Someone helped me with it but i cannot.pdf
Please review my code (java)Someone helped me with it but i cannot.pdf
 
So I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdfSo I have this code(StackInAllSocks) and I implemented the method but.pdf
So I have this code(StackInAllSocks) and I implemented the method but.pdf
 
Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdf
 
Need help with writing the test cases for the following code in java-.docx
Need help with writing the test cases for the following code in java-.docxNeed help with writing the test cases for the following code in java-.docx
Need help with writing the test cases for the following code in java-.docx
 
File LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdfFile LinkedList.java Defines a doubly-l.pdf
File LinkedList.java Defines a doubly-l.pdf
 
StackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdfStackInterface An interface for the ADT stack. Do not modif.pdf
StackInterface An interface for the ADT stack. Do not modif.pdf
 
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdfHow do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
How do I fix it in LinkedList.javaLabProgram.javaLinkedList.jav.pdf
 
Implementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdfImplementation The starter code includes List.java. You should not c.pdf
Implementation The starter code includes List.java. You should not c.pdf
 
Everything needs to be according to the instructions- thank you! SUPPO.pdf
Everything needs to be according to the instructions- thank you! SUPPO.pdfEverything needs to be according to the instructions- thank you! SUPPO.pdf
Everything needs to be according to the instructions- thank you! SUPPO.pdf
 
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdfUsing NetBeansImplement a queue named QueueLL using a Linked List .pdf
Using NetBeansImplement a queue named QueueLL using a Linked List .pdf
 

Mehr von actexerode

Now add to your GUI to allow the user to select a CUBES project to cla (1).pdf
Now add to your GUI to allow the user to select a CUBES project to cla (1).pdfNow add to your GUI to allow the user to select a CUBES project to cla (1).pdf
Now add to your GUI to allow the user to select a CUBES project to cla (1).pdf
actexerode
 

Mehr von actexerode (20)

Number of years to provide a given return In the information given in.pdf
Number of years to provide a given return In the information given in.pdfNumber of years to provide a given return In the information given in.pdf
Number of years to provide a given return In the information given in.pdf
 
Number of years needed to accumulate a future amount For the following.pdf
Number of years needed to accumulate a future amount For the following.pdfNumber of years needed to accumulate a future amount For the following.pdf
Number of years needed to accumulate a future amount For the following.pdf
 
Nowadays- we concern about health and nutrition as well as well-balanc.pdf
Nowadays- we concern about health and nutrition as well as well-balanc.pdfNowadays- we concern about health and nutrition as well as well-balanc.pdf
Nowadays- we concern about health and nutrition as well as well-balanc.pdf
 
Now your job is to write a Kotlin program to maintain the team roster-.pdf
Now your job is to write a Kotlin program to maintain the team roster-.pdfNow your job is to write a Kotlin program to maintain the team roster-.pdf
Now your job is to write a Kotlin program to maintain the team roster-.pdf
 
Now that the DFD has been created- it is time to build an object model.pdf
Now that the DFD has been created- it is time to build an object model.pdfNow that the DFD has been created- it is time to build an object model.pdf
Now that the DFD has been created- it is time to build an object model.pdf
 
Note- In C- integer division discards fractions- Ex- 6-4 is 1 (the 0-5.pdf
Note- In C- integer division discards fractions- Ex- 6-4 is 1 (the 0-5.pdfNote- In C- integer division discards fractions- Ex- 6-4 is 1 (the 0-5.pdf
Note- In C- integer division discards fractions- Ex- 6-4 is 1 (the 0-5.pdf
 
Now add to your GUI to allow the user to select a CUBES project to cla (1).pdf
Now add to your GUI to allow the user to select a CUBES project to cla (1).pdfNow add to your GUI to allow the user to select a CUBES project to cla (1).pdf
Now add to your GUI to allow the user to select a CUBES project to cla (1).pdf
 
Note on vegetarians and type of vegetarians-Must be well explained.pdf
Note on vegetarians and type  of vegetarians-Must be well explained.pdfNote on vegetarians and type  of vegetarians-Must be well explained.pdf
Note on vegetarians and type of vegetarians-Must be well explained.pdf
 
Not yet answered Points out of 1-00 Flag question Marshall developed p.pdf
Not yet answered Points out of 1-00 Flag question Marshall developed p.pdfNot yet answered Points out of 1-00 Flag question Marshall developed p.pdf
Not yet answered Points out of 1-00 Flag question Marshall developed p.pdf
 
Normal red blood cell shapes is a dominant trait- Sicklocell anemia is.pdf
Normal red blood cell shapes is a dominant trait- Sicklocell anemia is.pdfNormal red blood cell shapes is a dominant trait- Sicklocell anemia is.pdf
Normal red blood cell shapes is a dominant trait- Sicklocell anemia is.pdf
 
Neman- a single parent- quit his job and started a small independent b.pdf
Neman- a single parent- quit his job and started a small independent b.pdfNeman- a single parent- quit his job and started a small independent b.pdf
Neman- a single parent- quit his job and started a small independent b.pdf
 
Night ventilation- or night flushing- works best in climates where day.pdf
Night ventilation- or night flushing- works best in climates where day.pdfNight ventilation- or night flushing- works best in climates where day.pdf
Night ventilation- or night flushing- works best in climates where day.pdf
 
Newton Industries has a relevant range exlending to 31-800 unts each m.pdf
Newton Industries has a relevant range exlending to 31-800 unts each m.pdfNewton Industries has a relevant range exlending to 31-800 unts each m.pdf
Newton Industries has a relevant range exlending to 31-800 unts each m.pdf
 
New DNA is formed- by copying off RNA molecule templates- when nucleot.pdf
New DNA is formed- by copying off RNA molecule templates- when nucleot.pdfNew DNA is formed- by copying off RNA molecule templates- when nucleot.pdf
New DNA is formed- by copying off RNA molecule templates- when nucleot.pdf
 
New devices and device platforms are continually being released as the.pdf
New devices and device platforms are continually being released as the.pdfNew devices and device platforms are continually being released as the.pdf
New devices and device platforms are continually being released as the.pdf
 
Networking- What are the unix commands - steps to do the following- -.pdf
Networking- What are the unix commands - steps to do the following- -.pdfNetworking- What are the unix commands - steps to do the following- -.pdf
Networking- What are the unix commands - steps to do the following- -.pdf
 
Network standard and technologies use TCP-IP model such as- Network Ac.pdf
Network standard and technologies use TCP-IP model such as- Network Ac.pdfNetwork standard and technologies use TCP-IP model such as- Network Ac.pdf
Network standard and technologies use TCP-IP model such as- Network Ac.pdf
 
netflix uses DIGITAL MEDIA STRATEGIES such as rmail marketing- connect (1).pdf
netflix uses DIGITAL MEDIA STRATEGIES such as rmail marketing- connect (1).pdfnetflix uses DIGITAL MEDIA STRATEGIES such as rmail marketing- connect (1).pdf
netflix uses DIGITAL MEDIA STRATEGIES such as rmail marketing- connect (1).pdf
 
Netflix offers not only streaming entertainment but also a system of a.pdf
Netflix offers not only streaming entertainment but also a system of a.pdfNetflix offers not only streaming entertainment but also a system of a.pdf
Netflix offers not only streaming entertainment but also a system of a.pdf
 
Negative control means a regulator molecule is A)bound- and transcript.pdf
Negative control means a regulator molecule is A)bound- and transcript.pdfNegative control means a regulator molecule is A)bound- and transcript.pdf
Negative control means a regulator molecule is A)bound- and transcript.pdf
 

Kürzlich hochgeladen

Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 

Kürzlich hochgeladen (20)

Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 

Note- Help with methods public boolean remove(Object o)- public boolea.pdf

  • 1. Note: Help with methods public boolean remove(Object o), public boolean addAll(CiscCollection extends E> c), public Iterator iterator(), public Object[] toArray(), and public void clear(). package edu.ust.cisc; import java.util.*; public class CiscStack implements CiscCollection { /** * A reference to the node containing the element at the top of the stack (or null if stack is empty). */ private Node top; /** * Number of elements in the stack. */ private int size; /** * Inserts the specified item at the top of the stack. * * * @param item element being added to the stack * @throws NullPointerException if the item is null */ public void push(E item) { } /** * Returns and removes the element at the top of the stack. After this method finishes, {@code top} should refer to * the node containing the most recently added element (or null if no more elements remain in the stack). * * * @return the element at the top of the stack * @throws EmptyStackException if the stack is empty */ public E pop() { return null; } /** * * @return the element at the top of the stack * @throws EmptyStackException if the stack is empty */ public E peek() { return null; } /** * Returns the number of elements in this stack. * * @return the number of elements in this stack */ @Override public int size() { return 0; } /** * Returns {@code true} if this stack contains no elements. * * @return {@code true} if this stack contains no elements */ @Override public boolean isEmpty() { return false; } /** * Returns {@code true} if this stack contains the specified element (compared using the {@code equals} * method). * * @param o element whose presence in this stack is to be tested * @return {@code true} if this stack contains the specified element * @throws NullPointerException if the specified element is null */ @Override public boolean contains(Object o) { if(o==null){ throw new NullPointerException(); } Node node = top; while(node!=null) { if (node.data.equals(o)) { return true; } node = node.next; } return false; } /** * Inserts the specified item at the top of the stack. See the {@code push} operation. * * @param e element being added to the stack * @return {@code true} * @throws NullPointerException if the item is null */ @Override public boolean add(E e) { return false; } /** * This operation is not supported by CiscStack. * * @param o element to be removed from this collection, if present * @return {@code true} if this collection contained the specified element * @throws UnsupportedOperationException if the {@code remove} operation is not supported by this collection */ @Override public boolean remove(Object o) { return false; } /** * Adds all elements in the specified collection to this stack, in the order that they are returned by the * specified collection's iterator. * * @param c collection containing elements to be added to this stack * @return {@code true} if this stack changed as a result of the call * @throws NullPointerException if the specified collection is null */ @Override public boolean addAll(CiscCollection extends E> c) { return false; } /** * Returns an iterator over the elements in this stack from top to bottom. * * @return an iterator over the elements in this stack from top to bottom */ @Override public Iterator iterator() { return null; } /** * Returns an array containing all of the elements in this stack in proper sequence (from top to bottom). * * The returned array will be "safe" in that no references to it are maintained by this stack. The caller is * thus free to modify the returned array. * * @return an array containing all of the elements in this stack in proper sequence */ @Override public Object[] toArray() { return new Object[0]; } /** * Removes all of the elements from this stack. The stack will be empty after this call returns. */ @Override public void clear() { } /** * Returns a string representation of this stack. This string should consist of a comma separated list of * values contained in this stack, from top to bottom, surrounded by square brackets (examples: [3, 6, 7] and []). * * @return a string representation of this stack */ public String toString() { return null; } private static class
  • 2. Node { private E data; private Node next; private Node(E data, Node next) { this.data = data; this.next = next; } } private static class CiscStackIterator implements Iterator { /** * A reference to the node containing the next element to return. */ private Node nextNode; /** * Constructs an iterator beginning at the specified node. */ private CiscStackIterator(Node top) { } /** * Returns {@code true} if the iteration has more elements. (In other words, returns {@code true} if * {@link #next} would return an element rather than throwing an exception.) * * @return {@code true} if the iteration has more elements */ @Override public boolean hasNext() { return false; } /** * Returns the next element in the iteration. * * @return the next element in the iteration * @throws NoSuchElementException if the iteration has no more elements */ @Override public E next() { return null; } } }