Javasimple map iteratorTwo versions of Java map iterators.The good old while-hasNext like way: Iterator<Map.Entry<Key, Value>> it = theMap.entrySet().iterator(); or the modern for-each way:while (it.hasNext()) { Map.Entry<Key, Value> entry = it.next(); Logger.print(entry.getKey().someMethod() + : + entry.getValue().someMethod()); } for (Map.Entry<Key, Value> entry: theMap.entrySet()) depending of VM version and implementation, they can have different or equal performance, so be careful.{ } Ant: copy some files from non-flat dirs to one flat dirA piece of ant script, which would copy all *.txt and all *.jks files from different directories and subdirectories to one flat directory.This uses regexp mapper to delete directory part of paths to found files. <!-- copy non-compiled files (e.g. class resources) if needed --> <copy todir="${bin.dir}" verbose="true"> <fileset dir="${workspace}"> <include name="**/src*/**/*.txt"/> <include name="**/src*/**/*.jks"/> </fileset> <mapper type="regexp" from="^([^/]+)/([^/]+)/(.*)$$" to="\3"/> </copy> PHPStoring a file from a remote url to the local dirThe PHP 5 way of saving remote file (by http URL) to the local dir.file_put_contents('the.jpg', file_get_contents('http://mysite.com/the.jpg')); |