浏览代码

Completed Lab

Garrett Arant 6 年前
父节点
当前提交
7e43810f83
共有 1 个文件被更改,包括 1 次插入7 次删除
  1. 1
    7
      src/main/java/io/zipcoder/ItemParser.java

+ 1
- 7
src/main/java/io/zipcoder/ItemParser.java 查看文件

@@ -133,13 +133,7 @@ public class ItemParser {
133 133
             Object keyValue = mapEntry.getKey();
134 134
             //getValue method returns corresponding key's value
135 135
             Object value = mapEntry.getValue();
136
-            String time;
137
-            if(value.equals(1)){
138
-                 time = " time";
139
-            }
140
-            else{
141
-                 time = " times";
142
-            }
136
+            String time = (1 < (Integer)value) ?  " times": " time";
143 137
             sb.append("Price:   " + keyValue + "\t\t seen: " + value + time + "\n");
144 138
             sb.append("-------------\t\t -------------\n");
145 139
         }