Gangmax Blog

Groovy Grape

From here and here.

Groovy Grape is Groovy’s dependency manager. A big difference between Grape and other language dependency managers like pip, gem and npm is that, it uses language element(annoation, method call) to describe the dependencies inside a Groovy file, rather than a file out of the program itself like “requirements.txt”, “Gemfile” and “package.json”.

Java Lambda Type Inference

I see code like this:

Service.java
1
2
3
4
5
6
7
8
9
@Override
public void log(Request request) {
// ...
}

@Override
public void submit(Request request) {
Utils.submit(request, request -> log(request));
}

Here is the code in “Utils.java”:

Utils.java
1
2
3
4
public static void submit(Request request, Consumer<Request> comsumer) {
// Do something.
comsumer.accept(request);
}

“request -> log(request)” is a lambda expression, but how does it become a “Consumer”?

Git: Syncing a Fork

Sync a fork of a repository to keep it up-to-date with the upstream repository. From here. This is useful when you forked a repository in GitHub and want to get the latest changes made after the fork from the original repository to your repository.