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
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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started