1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Implemented Functional Interface Filter

Discussion in 'Client & Site Suggestions' started by SlashnHax, Jun 26, 2015.

  1. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    It'd be nice to be able to use lambdas in our .filter() in queries, what I suggest is adding a functional interface alongside the current abstract class, so we can use lambdas without breaking legacy code :D

    @Cloud pls
     
    Aidden likes this.
  2. Aidden

    Aidden Author of MaxiBots

    Joined:
    Dec 3, 2013
    Messages:
    6,482
    Likes Received:
    990
    Want want want. I wanted this before but never asked for it for some reason. SUPPORT
     
  3. SlashnHax

    Joined:
    Dec 10, 2014
    Messages:
    3,198
    Likes Received:
    1,041
    I feel like a lot of us have wanted it for ages, but afaik one of the main reasons it wasn't added was because if you replace the old filter with the new one, a lot of bots would break. BUT, if you implement them alongside each other, there's no harm :D
     
  4. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,937
    Likes Received:
    1,266
    Support immensely. We had to create filters, because at the time we weren't comfortable forcing Java 8. That has since changed, so there shouldn't be anything blocking us from doing this. We can deprecate the filter pattern, but leave it in for now.
     
  5. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    As a start, I've gone ahead and added an overload for QueryBuilder.filter(Predicate). In addition, the code now internally uses a predicate instead of a filter, and the filter class has had a toPredicate method added to it.
     
    SlashnHax likes this.

Share This Page

Loading...