Skip to content

Commit 445b11e

Browse files
author
DAC00
committed
writer implementation
1 parent 0439221 commit 445b11e

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
}

0 commit comments

Comments
 (0)