Skip to main content

Posts

Showing posts from 2015

Publishing to Maven Central Repository

Here you'll find a short overview of the actions required for publishing your artifacts to Maven Central Repository . The best way to publish your artifacts is using Open Source Software Repository Hosting (OSSRH) which runs Sonatype Nexus Platform . We'll follow the official guide with some remarks. Get permission for deployment. Deployment of artifacts. Release procedure. Get permission for deployment In the beginning you need to get permission for deployment under a certain Maven groupId. This should be done by signing up and creating a ticket in Sonatype JIRA . If the groupId already exists, either the initial requester should apply for a new user account or you should demonstrate an approval from the project owners. As a result, you'll get an account in OSSRH . For example, this is how I requested permission for com.github.dita-ot groupId. Deployment of artifacts The deployment is the first phase of artifacts publication. Here you need to create and s...

Java 8 Lambdas applied to QuickSort algorithm

In this article I'm going to review Java 8 Lambdas use cases after I've watched the Lambdas have come to Java! screencast from Typesafe. As a nice example, I've decided to count comparisons in the Quicksort algorithm. Basic algorithm. Inline lambdas. Method references. Basic algorithm Here is a basic implementation where we count comparisons in the Quicksort algorithm: public class QuickSort { public static long countComparisons(List<Integer> a) { if (a.size() <= 1) return 0; int p = getPivot(a); int i = 1; for (int j = 1; j < a.size(); j++) { if (a.get(j) < p) { if (j > i) swapInList(a, i, j); i++; } } swapInList(a, 0, i - 1); return countComparisons(a.subList(0, i - 1)) + countComparisons(a.subList(i, a.size())) + a.size() - 1; } private static Integer getPivot(List<Integer> a) { return...