File tree Expand file tree Collapse file tree 2 files changed +49
-0
lines changed
Project02Eclipse/src/com/hemebiotech/analytics Expand file tree Collapse file tree 2 files changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ package com .hemebiotech .analytics ;
2+
3+ import java .util .Map ;
4+
5+ /**
6+ *
7+ *
8+ */
9+
10+ public interface ISymptomWriter {
11+
12+ /**
13+ *
14+ * @param symptoms
15+ */
16+ void writeSymptoms (Map <String , Integer > symptoms );
17+
18+ }
Original file line number Diff line number Diff line change 1+ package com .hemebiotech .analytics ;
2+
3+ import java .io .FileWriter ;
4+ import java .io .IOException ;
5+ import java .util .Map ;
6+
7+ /**
8+ * Simple brute force implementation
9+ *
10+ */
11+ public class WriteSymptomDataToFile implements ISymptomWriter {
12+
13+ public WriteSymptomDataToFile (){
14+
15+ }
16+
17+ @ Override
18+ public void writeSymptoms (Map <String , Integer > symptoms ){
19+ if (symptoms != null ){
20+ try {
21+ FileWriter writer = new FileWriter ("result.out" );
22+ for (Map .Entry <String ,Integer > entry : symptoms .entrySet ()) {
23+ writer .write (entry .getKey () + " " + entry .getValue () + "\n " );
24+ }
25+ writer .close ();
26+ } catch (IOException e ) {
27+ throw new RuntimeException (e );
28+ }
29+ }
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments