Giter Club home page Giter Club logo

java-8's Introduction

Java-8 extensions

Synchronization

synchronizing the target each call of Supplier#get:

Supplier<Integer> value = sync(() -> 1);

Lazy Initializer

lazy initializing the value in common way:

Supplier<Int> value = lazy(() -> 1); 

lazy initializing the value in multi-threads:

Supplier<Int> value = lazy(() -> 1).lock();
Supplier<Int> value = lazy(() -> 1).lock(lock);

Function Operations

fill the first argument by curly:

BiFunction<Integer,Long,String> function2 = (left,right)-> left+"/"+right;

Function<T,R> function1 = curly(function2, 1);
Supplier<R>  supplier = function1.curly(3L); // "1/3"

fill the last argument by push:

BiFunction<Integer,Long,String> function2 = (left,right)-> left+"/"+right;

Function<T,R> function1 = push(function2, 1L);
Supplier<R>  supplier = function1.push(3); // "3/1"

drop the first argument by take:

BiFunction<Integer,Long,String> function2 = (left,right)-> left+"/"+right;

Function<T,R> function1 = drop(function2);

String value = function1.apply(3L);// "null/3"

Supplier<R>  supplier = function1.drop(); "null,null"

drop the last argument by pop:

BiFunction<Integer,Long,String> function2 = (left,right)-> left+"/"+right;

Function<T,R> function1 = pop(function2);

String value = function1.apply(3);// "3/null"

Supplier<R>  supplier = function1.pop(); "null,null"

java-8's People

Contributors

selonj avatar

Watchers

 avatar

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.