In the following example, we have used the TreeMap method, which stores its elements in a tree and orders its elements based on their values. Here in the example we have used the key of the element to show the values of the element. To retrieve the keys and values use keySet() and values() method respectively.
This program shows the data elements left after removing the particular element by specifying its key. Using the Iterator interface methods, we can traverse a collection from start to finish and safely remove elements from the underlying Collection.
Here is the code of program:
This program shows the data elements left after removing the particular element by specifying its key. Using the Iterator interface methods, we can traverse a collection from start to finish and safely remove elements from the underlying Collection.
Here is the code of program:
import java.util.*; |
No comments:
Post a Comment