@Test public void nonExistingDirectory() { FilesystemContainer fsc = new FilesystemContainer(new File( "/non/existing")); Assert.assertTrue(fsc.getItemIds().isEmpty()); }
@Override public Collection<File> getItemIds() { if (recursive) { final Collection<File> col = new ArrayList<File>(); for (int i = 0; i < roots.length; i++) { addItemIds(col, roots[i]); } return Collections.unmodifiableCollection(col); } else { File[] f; if (roots.length == 1) { if (filter != null) { f = roots[0].listFiles(filter); } else { f = roots[0].listFiles(); } } else { f = roots; } if (f == null) { return Collections .unmodifiableCollection(new LinkedList<File>()); } final List<File> l = Arrays.asList(f); Collections.sort(l); return Collections.unmodifiableCollection(l); } }
FilesystemContainer implements Container.Hierarchical { @Override public Collection<File> getItemIds() { if (recursive) { final Collection<File> col = new ArrayList<File>(); for (int i = 0; i < roots.length; i++) { addItemIds(col, roots[i]); } return Collections.unmodifiableCollection(col); } else { File[] f; if (roots.length == 1) { if (filter != null) { f = roots[0].listFiles(filter); } else { f = roots[0].listFiles(); } } else { f = roots; } if (f == null) { return Collections .unmodifiableCollection(new LinkedList<File>()); } final List<File> l = Arrays.asList(f); Collections.sort(l); return Collections.unmodifiableCollection(l); } } }
FilesystemContainer implements Container.Hierarchical { @Override public Collection<File> getItemIds() { if (recursive) { final Collection<File> col = new ArrayList<File>(); for (int i = 0; i < roots.length; i++) { addItemIds(col, roots[i]); } return Collections.unmodifiableCollection(col); } else { File[] f; if (roots.length == 1) { if (filter != null) { f = roots[0].listFiles(filter); } else { f = roots[0].listFiles(); } } else { f = roots; } if (f == null) { return Collections .unmodifiableCollection(new LinkedList<File>()); } final List<File> l = Arrays.asList(f); Collections.sort(l); return Collections.unmodifiableCollection(l); } } FilesystemContainer(File root);  FilesystemContainer(File root, boolean recursive);  FilesystemContainer(File root, String extension, boolean recursive);  FilesystemContainer(File root, FilenameFilter filter,
            boolean recursive); }
FilesystemContainer implements Container.Hierarchical { @Override public Collection<File> getItemIds() { if (recursive) { final Collection<File> col = new ArrayList<File>(); for (int i = 0; i < roots.length; i++) { addItemIds(col, roots[i]); } return Collections.unmodifiableCollection(col); } else { File[] f; if (roots.length == 1) { if (filter != null) { f = roots[0].listFiles(filter); } else { f = roots[0].listFiles(); } } else { f = roots; } if (f == null) { return Collections .unmodifiableCollection(new LinkedList<File>()); } final List<File> l = Arrays.asList(f); Collections.sort(l); return Collections.unmodifiableCollection(l); } } FilesystemContainer(File root);  FilesystemContainer(File root, boolean recursive);  FilesystemContainer(File root, String extension, boolean recursive);  FilesystemContainer(File root, FilenameFilter filter,
            boolean recursive); void addRoot(File root); @Override boolean areChildrenAllowed(Object itemId); @Override Collection<File> getChildren(Object itemId); @Override Object getParent(Object itemId); @Override boolean hasChildren(Object itemId); @Override boolean isRoot(Object itemId); @Override Collection<File> rootItemIds(); @Override boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed); @Override boolean setParent(Object itemId, Object newParentId); @Override boolean containsId(Object itemId); @Override Item getItem(Object itemId); @Override Collection<File> getItemIds(); @Override Property getContainerProperty(Object itemId, Object propertyId); @Override Collection<String> getContainerPropertyIds(); @Override Class<?> getType(Object propertyId); @Override int size(); FilenameFilter getFilter(); void setFilter(FilenameFilter filter); void setFilter(String extension); boolean isRecursive(); void setRecursive(boolean recursive); @Override boolean addContainerProperty(Object propertyId, Class<?> type,
            Object defaultValue); @Override Object addItem(); @Override Item addItem(Object itemId); @Override boolean removeAllItems(); @Override boolean removeItem(Object itemId); @Override boolean removeContainerProperty(Object propertyId); }
FilesystemContainer implements Container.Hierarchical { @Override public Collection<File> getItemIds() { if (recursive) { final Collection<File> col = new ArrayList<File>(); for (int i = 0; i < roots.length; i++) { addItemIds(col, roots[i]); } return Collections.unmodifiableCollection(col); } else { File[] f; if (roots.length == 1) { if (filter != null) { f = roots[0].listFiles(filter); } else { f = roots[0].listFiles(); } } else { f = roots; } if (f == null) { return Collections .unmodifiableCollection(new LinkedList<File>()); } final List<File> l = Arrays.asList(f); Collections.sort(l); return Collections.unmodifiableCollection(l); } } FilesystemContainer(File root);  FilesystemContainer(File root, boolean recursive);  FilesystemContainer(File root, String extension, boolean recursive);  FilesystemContainer(File root, FilenameFilter filter,
            boolean recursive); void addRoot(File root); @Override boolean areChildrenAllowed(Object itemId); @Override Collection<File> getChildren(Object itemId); @Override Object getParent(Object itemId); @Override boolean hasChildren(Object itemId); @Override boolean isRoot(Object itemId); @Override Collection<File> rootItemIds(); @Override boolean setChildrenAllowed(Object itemId, boolean areChildrenAllowed); @Override boolean setParent(Object itemId, Object newParentId); @Override boolean containsId(Object itemId); @Override Item getItem(Object itemId); @Override Collection<File> getItemIds(); @Override Property getContainerProperty(Object itemId, Object propertyId); @Override Collection<String> getContainerPropertyIds(); @Override Class<?> getType(Object propertyId); @Override int size(); FilenameFilter getFilter(); void setFilter(FilenameFilter filter); void setFilter(String extension); boolean isRecursive(); void setRecursive(boolean recursive); @Override boolean addContainerProperty(Object propertyId, Class<?> type,
            Object defaultValue); @Override Object addItem(); @Override Item addItem(Object itemId); @Override boolean removeAllItems(); @Override boolean removeItem(Object itemId); @Override boolean removeContainerProperty(Object propertyId); static String PROPERTY_NAME; static String PROPERTY_SIZE; static String PROPERTY_ICON; static String PROPERTY_LASTMODIFIED; static Collection<String> FILE_PROPERTIES; }