Iterable support for contains/query methods.

Discussion in 'Client & Site Suggestions' started by Tyrone, Mar 16, 2015.

  1. Hello.

    I've noticed that a few methods could benefit from the usage of iterable data types. Name ones such as:
    Just to name a few. This could work quite well with the changes to collections from Java 8.

    I don't see this being particularly useful in simpler, more commonly run scripts bots; but, it could very well have its niche.

    Haven't been here long, so I wouldn't know if/when this was discussed before.

    For further clarification, what I am suggesting is like such:

    Code (Text):
    2. List<Integer> userDefinedIDs = ...;
    3. // ...
    4. LocatableEntityQueryResults<GroundItem> query = GroundItems.getLoaded(userDefinedIDs);
    7. Set<String> userDefinedNames = ...;
    8. // ...
    9. LocatableEntityQueryResults<Npc> query = Npcs.getLoaded(userDefinedNames);
    And the such.

    Just a quick look shows that the following could benefit from this:

    1. Bank
    2. GroundItems
    3. Inventory
    4. Npcs
    5. Players


    #1 Tyrone, Mar 16, 2015
    Last edited: Mar 18, 2015
    SlashnHax likes this.
  2. Can you elaborate a bit more on what you're asking for?
  3. Updated accordingly.
  4. So just overloads for collections?
  5. Effectively.

    Saves the hassle of having to convert it to an array before calling one of these methods.

    This is also Java 8 where the collections have far more usage.
  6. I'll go ahead and add the overloads in a few frequently used places.
    --- Double Post Merged, Mar 23, 2015, Original Post Date: Mar 18, 2015 ---
    I began to do this with Collection overloads but I've began to run into a few signature erasure issues so I'll have to look into it and be a bit more selective.
  7. That was definitely a downside to this. The way this has been circumvented before was just to do

    Code (Text):
    2. containsAllOfNames(Iterable<String>)
    3. containsAllOfIds(Iterable<Integer>)
    I understand if you wouldn't feel comfortable compromising the integrity of the names. I'd sooner tear my own hairs out than drop my linearity. This was merely a suggestion of opportunity and not requirement.

    Most of these also pertain to items. So maybe some trickery with the ItemDefinition's could be had. Although, at that point, it would almost become more efficient just to drop the notion and call forth an array.

Share This Page