@@ -2821,7 +2821,7 @@ static public String contentsToClassPath(File folder) {
28212821 * @return array of possible package names
28222822 */
28232823 static public String [] packageListFromClassPath (String path ) {
2824- Hashtable table = new Hashtable ();
2824+ Map < String , Object > map = new HashMap < String , Object > ();
28252825 String pieces [] =
28262826 PApplet .split (path , File .pathSeparatorChar );
28272827
@@ -2832,32 +2832,32 @@ static public String[] packageListFromClassPath(String path) {
28322832 if (pieces [i ].toLowerCase ().endsWith (".jar" ) ||
28332833 pieces [i ].toLowerCase ().endsWith (".zip" )) {
28342834 //System.out.println("checking " + pieces[i]);
2835- packageListFromZip (pieces [i ], table );
2835+ packageListFromZip (pieces [i ], map );
28362836
28372837 } else { // it's another type of file or directory
28382838 File dir = new File (pieces [i ]);
28392839 if (dir .exists () && dir .isDirectory ()) {
2840- packageListFromFolder (dir , null , table );
2840+ packageListFromFolder (dir , null , map );
28412841 //importCount = magicImportsRecursive(dir, null,
2842- // table );
2842+ // map );
28432843 //imports, importCount);
28442844 }
28452845 }
28462846 }
2847- int tableCount = table .size ();
2848- String output [] = new String [tableCount ];
2847+ int mapCount = map .size ();
2848+ String output [] = new String [mapCount ];
28492849 int index = 0 ;
2850- Enumeration e = table . keys ();
2851- while ( e . hasMoreElements () ) {
2852- output [index ++] = (( String ) e . nextElement ()) .replace ('/' , '.' );
2850+ Set < String > set = map . keySet ();
2851+ for ( String s : set ) {
2852+ output [index ++] = s .replace ('/' , '.' );
28532853 }
28542854 //System.arraycopy(imports, 0, output, 0, importCount);
28552855 //PApplet.printarr(output);
28562856 return output ;
28572857 }
28582858
28592859
2860- static private void packageListFromZip (String filename , Hashtable table ) {
2860+ static private void packageListFromZip (String filename , Map < String , Object > map ) {
28612861 try {
28622862 ZipFile file = new ZipFile (filename );
28632863 Enumeration entries = file .entries ();
@@ -2872,8 +2872,8 @@ static private void packageListFromZip(String filename, Hashtable table) {
28722872 if (slash == -1 ) continue ;
28732873
28742874 String pname = name .substring (0 , slash );
2875- if (table .get (pname ) == null ) {
2876- table .put (pname , new Object ());
2875+ if (map .get (pname ) == null ) {
2876+ map .put (pname , new Object ());
28772877 }
28782878 }
28792879 }
@@ -2893,7 +2893,7 @@ static private void packageListFromZip(String filename, Hashtable table) {
28932893 * walk down into that folder and continue.
28942894 */
28952895 static private void packageListFromFolder (File dir , String sofar ,
2896- Hashtable table ) {
2896+ Map < String , Object > map ) {
28972897 //String imports[],
28982898 //int importCount) {
28992899 //System.err.println("checking dir '" + dir + "'");
@@ -2907,15 +2907,15 @@ static private void packageListFromFolder(File dir, String sofar,
29072907 if (sub .isDirectory ()) {
29082908 String nowfar =
29092909 (sofar == null ) ? files [i ] : (sofar + "." + files [i ]);
2910- packageListFromFolder (sub , nowfar , table );
2910+ packageListFromFolder (sub , nowfar , map );
29112911 //System.out.println(nowfar);
29122912 //imports[importCount++] = nowfar;
29132913 //importCount = magicImportsRecursive(sub, nowfar,
29142914 // imports, importCount);
29152915 } else if (!foundClass ) { // if no classes found in this folder yet
29162916 if (files [i ].endsWith (".class" )) {
29172917 //System.out.println("unique class: " + files[i] + " for " + sofar);
2918- table .put (sofar , new Object ());
2918+ map .put (sofar , new Object ());
29192919 foundClass = true ;
29202920 }
29212921 }
0 commit comments