Implemented Functional Interface Filter

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

  1. SlashnHax

    SlashnHax The Chosen One

    Joined:
    Dec 10, 2014
    Messages:
    2,838
    Likes Received:
    786
    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 The better executive ;)

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

    SlashnHax The Chosen One

    Joined:
    Dec 10, 2014
    Messages:
    2,838
    Likes Received:
    786
    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,507
    Likes Received:
    1,031
    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 The Developer

    Joined:
    Jul 28, 2013
    Messages:
    2,319
    Likes Received:
    744
    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...