-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathP1.java
More file actions
44 lines (33 loc) · 1.05 KB
/
Copy pathP1.java
File metadata and controls
44 lines (33 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.util.*;
class Category {
ArrayList<String> furniture = new ArrayList<String>();
ArrayList<String> cosmetic = new ArrayList<String>();
ArrayList<String> electronic = new ArrayList<String>();
HashMap<String, ArrayList<String>> hm = new HashMap<String, ArrayList<String>>();
void addProducts() {
furniture.add("Chair");
furniture.add("Table");
furniture.add("Bed");
cosmetic.add("Lipstick");
cosmetic.add("Vaseline");
cosmetic.add("Eyeliner");
electronic.add("Laptop");
electronic.add("Mobile");
electronic.add("TV");
hm.put("Furniture", furniture);
hm.put("Cosmetic", cosmetic);
hm.put("Electronic", electronic);
}
void show() {
for (String c : hm.keySet()) {
System.out.println(c + " : " + hm.get(c));
}
}
}
class Main {
public static void main(String[] args) {
Category a = new Category();
a.addProducts();
a.show();
}
}