How do filters work?

Discussion in 'Developer Support' started by Zallen93, Apr 1, 2015.

  1. Hi,

    Sorry to ask such a vague question but I see them about a bit but not sure what they really are, when is best to use them and how exactly to use them. I'm not expecting a full blown guide but maybe a little example then I can take it from there.

    Many thanks!
  2. The accept method in a filter determines whether to keep that object or not, if accept returns true it's kept, if it returns false it is removed.

    They can be used for stuff like, filtering out Npcs that are already in combat, either by checking if they have a health gauge, or have a target, or are being targeted.
    Geashaw likes this.
  3. Ah ok awesome, I just got tied up a bit because I saw the usual way to get objects then I saw the filter method and thought to myself which way is better - but I see now each one has its uses in certain circumstances. Thank you :)
  4. @Zallen93 If you're developing for RuneMate or are generally a fun guy who's interested in programming you should highly consider joining our Skype dev chat. We would have answered your question within seconds. Hit me up with your Skype via PM if you're interested. :)
  5. One question i have is since the client supports java 8 and its actually recommended. Why is there a seperate filter, sort and query api, instead of using generic collections classes and let the scripter use the new collections streams api?
  6. The query API was developed before we started forcing Java 8. @Cloud can speak on the merits of the query API over standard streams.
  7. Why aren't Lambdas working for filters?
  8. Because filters are abstract classes, not functional interfaces

Share This Page