GithubHelp home page GithubHelp logo

hw7's People

Contributors

siegfriedix avatar

Watchers

 avatar

hw7's Issues

Homework7

Task
To better understand how the stream operations work, we suggest
you to implement such methods:

package com.geekhub.collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Bin aryOperator;
import java.util.function.Con sumer;
import java.util.function.Fun ction;
import java.util.function.Pre dicate;
public class CollectionUtils {
private CollectionUtils() {
}
public static < E > List< E > filter(List< E > elements, Predicate< E > filter) {
//TODO Implement me
return null ;
}
public static < E > boolean anyMatch(List< E > elements, Predicate< E > predicate) {
//TODO Implement me
return false ;
}
public static < E > boolean allMatch(List< E > elements, Predicate< E > predicate) {
//TODO Implement me
return false ;
}
public static < E > boolean noneMatch(List< E > elements, Predicate< E > predicate) {
//TODO Implement me
return false ;
}
public static < T , R > List< R > map(List< T > elements, Function< T , R > mappingFunction) {
//TODO Implement me
return null ;
}
public static < E > Optional< E > max(List< E > elements, Comparator< E > comparator) {
//TODO Implement me
return null ;
}
public static < E > Optional< E > min(List< E > elements, Comparator< E > comparator) {
//TODO Implement me
return null ;
}
public static < E > List< E > distinct(List< E > elements) {
//TODO Implement me
return null ;
}
public static < E > void forEach(List< E > elements, Consumer< E > consumer) {
//TODO Implement me
}
public static < E > Optional< E > reduce(List< E > elements, BinaryOper ator< E > accumulator) {
//TODO Implement me
return null ;
}
public static < E > E reduce( E seed, List< E > elements, BinaryOperat or< E > accumulator) {
//TODO Implement me
return null ;
}
public static < E > Map<Boolean, List< E >> partitionBy(List< E > elements, Predicate< E > predicate) {
//TODO Implement me
return null ;
}
public static < T , K > Map< K , List< T >> groupBy(List< T > elements, Fu nction< T , K > classifier) {
//TODO Implement me
return null ;
}
public static < T , K , U > Map< K , U > toMap(List< T > elements,
Function< T , K > keyFunction,
Function< T , U > valueFunction,
BinaryOperator< U > mergeFunction) {
//TODO Implement me
return null ;
}
}
You are NOT supposed to use the stream API inside these
methods.

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.