Giter Site home page Giter Site logo

stage1-module5-task1's Introduction

Tasks

1. Create Predicate

Implement the program which return Predicate<List<String>>. Predicate should check all values of the list and return true if all of them start with letter in upper case only.

public Predicate<List<String>> isValuesStartWithUpperCase() { return x -> {};}

2. Create Consumer

Implement the program which return Consumer<List<Integer>>. Consumer should find all even values and add them to the end of list.

public Consumer<List<Integer>> addEvenValuesAtTheEnd() {return x -> {};}

Example

Input

[48, 13, 100, 5, 222, 3]

Output

[48, 13, 100, 5, 222, 3, 48, 100, 222]

3. Create Supplier

Implement the program which have a method with one argument List<String> and return Supplier<List<String>>. Supplier should filter out collection according rules below.

  • String must start with the letter in upper case;
  • String must end with '.';
  • String must contain more than 3 words;

public Supplier<List<String>> filterCollection(List<String> values) {return () -> {return values...};}

Example

  • "This is a good way to learn Java Functional Interfaces." - correct string.
  • "this is a good way to learn Java Functional Interfaces." - incorrect string.

Input

["hello world in Java.", "MJC is a great school."]

Output

["MJC is a great school."]

4. Create Function

Implement the program which return Function<List<String>, Map<String, Integer>>. Function should create a map where key is a value of the list and the value is size of the key.

public Function<List<String>, Map<String, Integer>> stringSize() {return x -> {return ...};}

Example

Input

["Hello", "MJC"]

Output

[{Hello, 5}. {MJC, 3}]

5. Create Bi-Function

Implement the program which return BiFunction<List<Integer>, List<Integer>, List<Integer>>. Function should return new List which store values from first and second lists.

public BiFunction<List<Integer>, List<Integer>, List<Integer>> concatList() { return (list1, list2) -> {return new ArrayList()...}

Example

Input

Array 1 - [2, 4, 5, 10]

Array 2 - [3, 1, 10, 5]

Output

[2, 4, 5, 10, 3, 1, 10, 5]

stage1-module5-task1's People

Contributors

sultaaann avatar vponkratina 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.