回答編集履歴
1
コードのデバッグ
answer
CHANGED
@@ -11,10 +11,8 @@
|
|
11
11
|
class relayUserVnue{
|
12
12
|
public static void main(String args[]){
|
13
13
|
|
14
|
-
// 文字列ビルダーオブジェクトを用意
|
15
|
-
StringBuilder builder = new StringBuilder();
|
16
14
|
// 会場IDのハッシュ(連想配列)を用意
|
17
|
-
HashMap<String,
|
15
|
+
HashMap<String,Integer> venueIdMap = new venueMap<String,Integer>();
|
18
16
|
|
19
17
|
venueIdMap.put("alkjf;akjdf", 101);
|
20
18
|
venueIdMap.put("odfka:lsdfk", 102);
|
@@ -33,26 +31,25 @@
|
|
33
31
|
// 入力データファイルを仮に"UserVenueStar.txt"としている
|
34
32
|
try (BufferedReader reader = new BufferedReader(new FileReader("UserVenueStar.txt"))) {
|
35
33
|
String strData = reader.readLine();
|
36
|
-
String[]
|
34
|
+
String[] strItem;
|
37
35
|
int userId, venueId, star;
|
38
36
|
System.out.println("userID venueID star");
|
39
37
|
while (strData != null){
|
40
|
-
builder.append(string + System.getProperty("line.separator"));
|
41
38
|
strData = reader.readLine();
|
42
|
-
|
39
|
+
strItem = strData.split(" ");
|
43
|
-
if (userIdMap.containsKey(
|
40
|
+
if (userIdMap.containsKey(strItem[0])){
|
44
|
-
userId = userIdMap.containsKey(
|
41
|
+
userId = userIdMap.containsKey(strItem[0]);
|
45
42
|
}else{
|
46
43
|
userId = 0;
|
47
44
|
}
|
48
45
|
|
49
|
-
if (venueIdMap.containsKey(
|
46
|
+
if (venueIdMap.containsKey(strItem[1])){
|
50
|
-
venueId = venueIdMap.containsKey(
|
47
|
+
venueId = venueIdMap.containsKey(strItem[1]);
|
51
48
|
}else{
|
52
49
|
venueId = 0;
|
53
50
|
}
|
54
51
|
|
55
|
-
star =
|
52
|
+
star = sstrItem[2];
|
56
53
|
System.out.println(userId + " " + venueId + " " + star);
|
57
54
|
}
|
58
55
|
} catch (Exception e) {
|