Question: Java programming Do the same question with List Array Write a method with the name eraser that will get two arguments: maparr_plants (Map array

Java programming Do the same question with List Array

Write a method with the name "eraser that will get two arguments: maparr_plants (Map array of objects of a kind of class Plant), and eraselist (One dimensional array of integers). That method should erase the elements of the maparr_plants which their keys are matching the elements of the eraselist.

(Hint: Check all elements of eraselist, and erase the matching (key) elements of the maparr_plants.) (13 points)

Solution:

public static void eraser(Map maparr_plants,

int [] eraselist) {

for (i=0; i

if(maparr_plants.containsKey(i) {

maparr_plants.remove(i);

}

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!