Java Code Examples for org.openide.util.Enumerations#queue()
The following examples show how to use
org.openide.util.Enumerations#queue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileObject.java From netbeans with Apache License 2.0 | 6 votes |
/** Enumerate all children of this folder. If the children should be enumerated * recursively, first all direct children are listed; then children of direct subfolders; and so on. * * @param rec whether to enumerate recursively * @return enumeration of type <code>FileObject</code> */ public Enumeration<? extends FileObject> getChildren(final boolean rec) { class WithChildren implements Enumerations.Processor<FileObject, FileObject> { @Override public FileObject process(FileObject fo, Collection<FileObject> toAdd) { if (rec && fo.isFolder()) { for (FileObject child : fo.getChildren()) { try { if (!FileUtil.isRecursiveSymbolicLink(child)) { // #218795 toAdd.add(child); } } catch (IOException ex) { ExternalUtil.LOG.log(Level.INFO, null, ex); } } } return fo; } } return Enumerations.queue(Enumerations.array(getChildren()), new WithChildren()); }
Example 2
Source File: AbstractFolder.java From netbeans with Apache License 2.0 | 6 votes |
/** Creates enumeration of existing subfiles in all tree * of files. * * @param rec should it be recursive or not * @return enumeration of AbstractFolders */ final Enumeration<AbstractFolder> existingSubFiles(boolean rec) { if (!rec) { return Enumerations.array(subfiles()); } else { class P implements org.openide.util.Enumerations.Processor<AbstractFolder, AbstractFolder> { public AbstractFolder process(AbstractFolder af, Collection<AbstractFolder> toAdd) { toAdd.addAll(Arrays.asList(af.subfiles())); return af; } } return Enumerations.queue(Enumerations.singleton(this), new P()); } }
Example 3
Source File: EnumerationsTest.java From netbeans with Apache License 2.0 | 5 votes |
/** * @param filter the set.contains (...) is called before each object is produced * @return Enumeration */ protected <T,R> Enumeration<R> queue(Collection<T> initContent, final QueueProcess<T,R> process) { class C implements Enumerations.Processor<T,R> { public R process(T object, Collection<T> toAdd) { return process.process(object, toAdd); } } return Enumerations.queue( Collections.enumeration(initContent), new C() ); }