subject

A Set is an abstract data type (ADT) that stores unique elements. It provides the following operations: a. void add(E element)- adds an element to the set. If the same element (according to equals(Object)) is already in the set, the new element is ignored . Note: this is different from how Maps work!

b. void remove(E element)- removes an element from the set.

c. boolean contains(E element)- returns true if the element is in the set, and false otherwise.

d. int size() - returns the number of elements stored in the set.

e. Iterator iterator() - returns an iterator that can be used to iterate over the elements in the set. This is necessary to enable a data structure to work with Java's for loops.

You can think of a Set like a Map that only stores keys (and no values). In fact, a Set can be implemented using a Map - the elements of the set are keys in the Map (the values in the Map do not matter and can be null or some other placeholder value).

Create a generic Set interface that provides the methods described above.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:40
Write c function that can replace all the positive elements to 0 and negative to 1 in undefined length one-dimensional array. test your program in the main program by defining one-dimensional array of 6 elements
Answers: 1
question
Computers and Technology, 22.06.2019 11:00
Which action is good business etiquette? a. switching your cell phone off before you enter a meeting b. keeping your cell phone on low volume before you enter a meeting c. setting a pleasant ring tone on your cell phone before you enter a meeting d. setting a standard ringtone on your cell phone before you enter a meeting
Answers: 1
question
Computers and Technology, 23.06.2019 20:00
Me ajude por favor , coloquei uma senha e não consigo tira-la no chorme
Answers: 2
question
Computers and Technology, 24.06.2019 00:00
Afashion designer wants to increase awareness about her brand. which network can she use and why she can use the blank to blank her products online. answers for the first blank: internet, extranet, or intranet answers for the second blank: market, design, and export
Answers: 1
You know the right answer?
A Set is an abstract data type (ADT) that stores unique elements. It provides the following operatio...
Questions
question
Spanish, 20.06.2019 18:02
Questions on the website: 13722360