У меня есть проблема, как продолжить, кто-нибудь может помочь код?
Дайте мне знать основную концепцию ...
readfile data => IBARAKI MitoCity
TOCHIGI UtunomiyaCity
GUNMA MaehashiCity
SAITAMA SaitamaCity
CHIBA ChibaCity
TOKYO Sinjyuku
KANAGAWA YokohamaCity
write text file output => CHIBA : ChibaCity
GUNMA : MaehashiCity
TOKYO : Sinjyuku
IBARAKI : MitoCity
SAITAMA : SaitamaCity
TOCHIGI : UtunomiyaCity
KANAGAWA : YokohamaCity
Код
import java.util.*;
import java.io.*;
public class ReadFileDemo{
public static void main(String[] args) throws IOException {
Reader reader = new InputStreamReader(new
FileInputStream(args[0]),"UTF-8");
BufferedReader br = new BufferedReader(reader);
Writer writer = new OutputStreamWriter(new
FileOutputStream("textB.txt"),"UTF-8");
BufferedWriter bw = new BufferedWriter(writer);
Map<String,String> map = new HashMap<String,String>();
String line=null;
while((line=br.readLine())!=null) {
String[] parts = line.split(" ");
String key=parts[0];
String value=parts[1];
map.put(key,value);
}
Map<String, String> treemap = new TreeMap<String, String>(map);
}
}
Спасибо !!