-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDemo05SortText.java
More file actions
28 lines (26 loc) · 931 Bytes
/
Demo05SortText.java
File metadata and controls
28 lines (26 loc) · 931 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package Demo13;
import java.io.*;
import java.util.HashMap;
import java.util.Properties;
public class Demo05SortText {
public static void main(String[] args) throws IOException {
HashMap<String,String> hm = new HashMap<>();
BufferedReader br = new BufferedReader(new FileReader("src\\Demo13\\buffered.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter("src\\Demo13\\bufferedOut.txt"));
String line = "";
while((line = br.readLine())!=null){
/*Properties prop = new Properties();
prop.load(line);*/
String[] arr = line.split("\\.");
hm.put(arr[0],arr[1]);
}
for(String key : hm.keySet()){
String value = hm.get(key);
line = key + "." + value;
bw.write(line);
bw.newLine();
}
bw.close();
br.close();
}
}