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

Iterable support for contains/query methods.

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

  1. Tyrone

    Tyrone Darn Hunk

    Joined:
    Mar 16, 2015
    Messages:
    11
    Likes Received:
    13
    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):
    1.  
    2. List<Integer> userDefinedIDs = ...;
    3. // ...
    4. LocatableEntityQueryResults<GroundItem> query = GroundItems.getLoaded(userDefinedIDs);
    5.  
    6.  
    7. Set<String> userDefinedNames = ...;
    8. // ...
    9. LocatableEntityQueryResults<Npc> query = Npcs.getLoaded(userDefinedNames);
    10.  
    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


    Thanks,

    ~T
     
    #1 Tyrone, Mar 16, 2015
    Last edited: Mar 18, 2015
    SlashnHax likes this.
  2. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    Can you elaborate a bit more on what you're asking for?
     
  3. Tyrone

    Tyrone Darn Hunk

    Joined:
    Mar 16, 2015
    Messages:
    11
    Likes Received:
    13
    Updated accordingly.
     
  4. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    So just overloads for collections?
     
  5. Tyrone

    Tyrone Darn Hunk

    Joined:
    Mar 16, 2015
    Messages:
    11
    Likes Received:
    13
    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. Cloud

    Cloud Engineer

    Joined:
    Jul 28, 2013
    Messages:
    2,777
    Likes Received:
    1,124
    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. Tyrone

    Tyrone Darn Hunk

    Joined:
    Mar 16, 2015
    Messages:
    11
    Likes Received:
    13
    That was definitely a downside to this. The way this has been circumvented before was just to do

    Code (Text):
    1.  
    2. containsAllOfNames(Iterable<String>)
    3. containsAllOfIds(Iterable<Integer>)
    4.  
    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

Loading...