/** * Returns the subFolder element matching the supplied folder name. * * @param folderName the name of the subFolder to find. * @return the subFolder element if found {@code null} otherwise. */ public BluetoothMapFolderElement getSubFolder(String folderName) { for (BluetoothMapFolderElement subFolder : subFolders) { if (subFolder.getName().equals(folderName)) return subFolder; } return null; }
/** * Fetch the root folder. * * @return the parent folder or null if we are at the root folder. */ public BluetoothMapFolderElement getRoot() { BluetoothMapFolderElement rootFolder = this; while (rootFolder.getParent() != null) rootFolder = rootFolder.getParent(); return rootFolder; }