Esempio n. 1
0
 public Entry get(String word) // zwraca pozycjê zawieraj¹c¹ podane s³owo
     {
   for (Entry e : dict) {
     if (e.getWord().equals(word)) return e;
   }
   return null;
 }
Esempio n. 2
0
  public void saveDB(String filename) // zapisuje baze s³ów do pliku
      {
    try {
      FileOutputStream fstream = new FileOutputStream(filename);

      DataOutputStream out = new DataOutputStream(fstream);
      BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(out));

      for (Entry e : dict) {
        bw.write(e.getWord() + "\n");
        bw.write(e.getClue() + "\n");
      }

      bw.close();
    } catch (Exception e) {
      JOptionPane.showMessageDialog(null, e.getLocalizedMessage());
    }
  }