1、JAVA java ArryList ArryList TreeMap package collection_package; import java.io.*; import java.util.*; public class InsertString public static String s = new String(); public void gettext() try / BufferedReader input = new BufferedReader(new FileReader(“./chinese_word.txt“); s = input.readLine(); inp
2、ut.close(); catch (Exception e) System.out.println(“Read Fail“); / ArrayList 4 1 public ArrayList split(String str, int l) String strarray = str.split(“,“); ArrayList al = new ArrayList(); for (int i = 0; i list, int n) String stemp; String strre; String strresult; / ArrayList add ArrayList for (int
3、 i = 0; i 0; i-) sretain = pare(sretain, is.split(is.s, i), i); / System.out.println(sa.al); / TreeMap TreeMap tm = new TreeMap(); Iterator it = sa.al.iterator(); while (it.hasNext() String s = (String) it.next(); tm.put(sa.sen.indexOf(s), s); / ArrayList TreeMap / TreeMap values System.out.println(tm.values(); chinese_word.txt , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,