How can I create an utility class?

For a completely stateless utility class in Java, I suggest the class be declared public and final, and have a private constructor to prevent instantiation. The final keyword prevents sub-classing and can improve efficiency at runtime. The class should contain all static methods and should not be declared abstract (as that would imply the class is not concrete and has to be implemented in … Read more

Implement touch using Python?

Looks like this is new as of Python 3.4 – pathlib. This will create a file.txt at the path. — Path.touch(mode=0o777, exist_ok=True) Create a file at this given path. If mode is given, it is combined with the process’ umask value to determine the file mode and access flags. If the file already exists, the function succeeds if … Read more