Code example for Vector

Methods: add, contains

0
	public static void addFile(File f) throws IOException {
		addURL(f.toURI().toURL());
	} 
 
	public static void addURL(URL u) throws IOException {
		if (added.contains(u)) return;
		added.add(u);
		URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
		Class<?> sysclass = URLClassLoader.class;
		try { 
			Method method = sysclass.getDeclaredMethod("addURL", parameters);
			method.setAccessible(true);
			method.invoke(sysloader, new Object[] { u });
		} catch (Throwable t) {
			throw new IOException("Error, could not add URL to system classloader");
		} 
	} 
}