Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java programming Do the same question with List Array (list_to_map) class Plant { private String p_name; private String p_type; private String p_ordo; public void set_p_name(String

Java programming Do the same question with List Array (list_to_map)

class Plant {

private String p_name;

private String p_type;

private String p_ordo;

public void set_p_name(String s_name) { public String get_p_name() {

p_name = s_name; } return p_name; }

public void set_p_type(String s_type) { public String get_p_type() {

p_type = s_type; } return p_type;}

public void set_p_ordo(String s_ordo) { public String get_p_ordo() {

p_ordo = s_ordo; } return p_ordo;}

}

Write a method with the name "map_to_list that it should have two arguments maparr_plants (Map array of objects of a kind of class Plant, and keys are integer numbers), and listarr_plants (List array of objects of a kind of class Plant). This method should copy all elements of the maparr_plants into the empty array listarr_plants.

Solution:

public static void map_to_list(Map maparr_plants,

List listarr_plants) {

Plant plant;

for (Map.Entry entry: maparr_plants.entrySet()) {

plant=entry.getValue();

lisarr_plants.add(plant);

}

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions

Question

7. List behaviors to improve effective leadership in meetings

Answered: 1 week ago

Question

6. Explain the six-step group decision process

Answered: 1 week ago