How to find the jar file (with maven artifacts) for a class
Go to the site https://jar-download.com/, select ‘Class search’ and enter your class name.
Method References
There are four kinds of method references:
Kind | Example |
---|---|
Reference to a static method | ContainingClass::staticMethodName |
Reference to an instance method of a particular object | containingObject::instanceMethodName |
Reference to an instance method of an arbitrary object of a particular type | ContainingType::methodName |
Reference to a constructor | ClassName::new |
How to encode a URL string?
In a URL not all characters are allowed. Therefore strings have to be URL encoded.
This is done by the java method: java.net.URLEncoder.Encode(<string>, <character-encoding>)
.
Where the <character-encoding> is typically set to “UTF-8”.
How to parse command line arguments?
Use the package ‘org.apache.commons.cli
‘.
How to store temporary file (or how to use jimfs
To store temporary files use com.google.common.jimfs.Jimfs.
However, to iterate over the contents a DirectoryStream (obtained via Files.newDirectoryStream(path)) doesn’t seem to work.
Instead use Files.walkFileTree(path, simpleFileVisitor<Path>).