public String[] listAll() throws IOException {List<String> files = new ArrayList<>();NoSuchFileException exc = null;try {for(String f : primaryDir.listAll()) {String ext = getExtension(f);if (primaryExtensions.contains(ext)) {files.add(f);}}} catch (NoSuchFileException e) {exc = e;}try {for(String f : secondaryDir.listAll()) {String ext = getExtension(f);if (primaryExtensions.contains(ext) == false) {files.add(f);}}} catch (NoSuchFileException e) {if (exc != null) {throw exc;}if (files.isEmpty()) {throw e;}}if (exc != null && files.isEmpty()) {throw exc;}String[] result = files.toArray(new String[files.size()]);Arrays.sort(result);return result;}

public String [ ] listAll ( ) throws IOException { List < String > files = new ArrayList < > ( ) ; NoSuchFileException exc = null ; try { for ( String f : primaryDir . listAll ( ) ) { String ext = getExtension ( f ) ; if ( primaryExtensions . contains ( ext ) ) { files . add ( f ) ; } } } catch ( NoSuchFileException e ) { exc = e ; } try { for ( String f : secondaryDir . listAll ( ) ) { String ext = getExtension ( f ) ; if ( primaryExtensions . contains ( ext ) == false ) { files . add ( f ) ; } } } catch ( NoSuchFileException e ) { if ( exc != null ) { throw exc ; } if ( files . isEmpty ( ) ) { throw e ; } } if ( exc != null && files . isEmpty ( ) ) { throw exc ; } String [ ] result = files . toArray ( new String [ files . size ( ) ] ) ; Arrays . sort ( result ) ; return result ; }
public override string[] ListAll(){ISet<string> files = new JCG.HashSet<string>();DirectoryNotFoundException exc = null;try{foreach (string f in primaryDir.ListAll()){files.Add(f);}}catch (DirectoryNotFoundException e){exc = e;}try{foreach (string f in secondaryDir.ListAll()){files.Add(f);}}catch (DirectoryNotFoundException ){if (exc != null){throw exc;}if (files.Count == 0){throw; }}if (exc != null && files.Count == 0){throw exc;}return files.ToArray();}
