Lancet: A Comprehensive, Efficient, and Reusable Util Function Library of Go

Lancet is a comprehensive, efficient, and reusable util function library of Go, inspired by the Java Apache Commons package and lodash.js.

Features

  •  Comprehensive, efficient, and reusable
  •  100+ common Go util functions, support string, slice, DateTime, net, crypt
  •  Only depend on the Go standard library
  •  Unit test for every exported function.

Installation

go get github.com/duke-git/lancet

Usage

Lancet organizes the code into package structure, and you need to import the corresponding package name when using it. For example, if you use string-related functions, import the strutil package as below:

How To Copy Files From One Directory to Another in Java: Example

Hello folks. I have been programming in Java for a long time, and you won't believe it, but there was no file copy method in the Java API until Java 7. Our options were either to: write it ourselves using a FileInputStream, a FileOutputStream, and a buffer to copy bytes from one to the other; or, better yet, use the FileChannel.transferTo() method or the Apache Commons FileUtils, which was a lifesaver in those days and still is today. 

JDK has evolved now, and you have a decent API to copy files from one directory to another. In this article, I'll show you both the pre-Java code for copying files from one directory to another as well post Java 7 code, which makes this task a lot easier.