Giter VIP home page Giter VIP logo

boilerplate's Introduction

Boilerplate

Collection of boilerplate code that should ease writing Java 8+ code

Status

Stable branch

Build Status

Development branch

Build Status

Usage

Hashes

Murmur3-based hashing for arbitrary objects.

FastReadWriteLock

Implements a multiple-reader / single-writer lock relying on a single semaphore. Writers lock with write(), readers lock with read(). Both release the lock with release(). The lock must be used correctly by the programmer (releases made randomly are unchecked, and will break the locking system). Non-reentrant (calling write() twice produces a deadlock).

PrimitiveArrays

A set of utility methods for changing (through copy) the type of arrays. Allows for both widening and narrowing "casts" (with precision loss).

Streams.flatten

Flattens a recursive, hierarchical data structure to a Stream.

For instance:

Tree tree = new MyTree();
TreeNode root = tree.getRoot();
Stream<TreeNode> s = Streams.flatten(root, t -> t.getChildren().stream())

Would traverse the tree breadth-first.

SmallestN

A collector that efficiently selects the desired number of smallest elements from the stream. Returns a Guava MinMaxPriorityQueue, that is used to efficiently store only the required elements. This collector has in general better performance than the equivalent .sort().limit().collect() chain.

Import in your project

I warmly suggest to use Gradle, Maven or a similar system to deal with dependencies within your project. In this case, you can use this product by importing the following Maven dependency:

<dependency>
    <groupId>org.danilopianini</groupId>
    <artifactId>boilerplate</artifactId>
    <version>VERSION_YOU_WANT_TO_USE</version>
</dependency>

or the following Gradle dependency:

compile 'org.danilopianini:boilerplate:VERSION_YOU_WANT_TO_USE'

Alternatively, you can grab the latest jar and throw it in your classpath. In this case, be sure to include the dependencies of this project in your classpath as well.

boilerplate's People

Contributors

danysk avatar

Watchers

 avatar  avatar  avatar

boilerplate's Issues

Hashing

It would be useful to move here all the utility methods used to generate hash codes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.