В моем простом приложении swing я создал несколько текстовых полей, в которые пользователь вводит пути к папкам, которые приложение будет использовать. Они хранятся с использованием API-интерфейсов.Как перебирать узлы пользовательских настроек в java
На данный момент у меня возникло хранить пути папок в ArrayList, а также предпочтения, а затем перебирать ArrayList, который кажется немного бессмысленным, когда я должен иметь возможность перебирать предпочтения пользователей для папки •. Как я могу получить все предпочтения для пользователя на определенном узле и выполнить итерацию через них.
Мой код:
Для сбора предпочтений:
public ArrayList<String> folderList() throws IOException, SAXException, TikaException, SQLException, ParseException, URISyntaxException{
ArrayList<String> AL_folderList=new ArrayList<String>();
String PathForBRAVO=null;
String PathForImpedance=null;
String PathForHRM=null;
String PathForDiagnosis=null;
String PathForBreath=null;
if(txtPathForBRAVO!=null){
prefs.put(PathForBRAVO, txtPathForBRAVO.getText());
AL_folderList.add(txtPathForBRAVO.getText());
}
if(txtPathForImpedance!=null){
prefs.put(PathForImpedance, txtPathForImpedance.getText());
AL_folderList.add(txtPathForImpedance.getText());
}
if(txtPathForHRM!=null){
prefs.put(PathForHRM, txtPathForHRM.getText());
AL_folderList.add(txtPathForHRM.getText());
}
if(txtPathForDiagnosis!=null){
prefs.put(PathForDiagnosis, txtPathForDiagnosis.getText());
AL_folderList.add(txtPathForDiagnosis.getText());
}
if(txtPathForBreath!=null){
prefs.put(PathForBreath, txtPathForBreath.getText());
AL_folderList.add(txtPathForBreath.getText());
}
Iterator.main(null);
return AL_folderList;
}
Это получает передается итератор
public static void main(String[] args) throws IOException, SAXException, TikaException, SQLException, ParseException, URISyntaxException {
Preferences userPrefs = Preferences.userNodeForPackage(TBB_SQLBuilder.class);
<<<<<<<<<<<<<<< How to iterate through the Preferences node holding PathForBreath,PathForHRM etc rather than having to iterate through the returned ArrayList from the folderList method????
}