質問編集履歴
1
試行錯誤中のソースを追記いたしました
title
CHANGED
File without changes
|
body
CHANGED
@@ -51,4 +51,42 @@
|
|
51
51
|
0002:ばなな
|
52
52
|
0003:めろん
|
53
53
|
0005:すもも
|
54
|
+
```
|
55
|
+
#試行錯誤中のソース
|
56
|
+
```
|
57
|
+
package Sample;
|
58
|
+
|
59
|
+
import java.util.ArrayList;
|
60
|
+
import java.util.List;
|
61
|
+
import java.util.Map;
|
62
|
+
import java.util.TreeMap;
|
63
|
+
|
64
|
+
public class Sample_4 {
|
65
|
+
|
66
|
+
private static List<List<String>> check = new ArrayList<>();
|
67
|
+
|
68
|
+
public static void main(String[] args) {
|
69
|
+
|
70
|
+
Map<String,String> fruit = new TreeMap<>();
|
71
|
+
|
72
|
+
fruit.put("0001", "りんご");
|
73
|
+
fruit.put("0003", "めろん");
|
74
|
+
fruit.put("0004", "めろん");
|
75
|
+
fruit.put("0005", "すもも");
|
76
|
+
fruit.put("0002", "ばなな");
|
77
|
+
|
78
|
+
for(int i = 0; i < fruit.size(); i++) {
|
79
|
+
List<String> Id = new ArrayList<>();
|
80
|
+
Id.add(fruit.get(i));
|
81
|
+
|
82
|
+
if(check.contains(Id)) {
|
83
|
+
continue;
|
84
|
+
}
|
85
|
+
|
86
|
+
check.add(Id);
|
87
|
+
System.out.println(i + ":" + fruit.get(i));
|
88
|
+
}
|
89
|
+
|
90
|
+
}
|
91
|
+
}
|
54
92
|
```
|