Get ArrayList Size

Discussion in 'Plugin Development' started by ProStriker123, Nov 10, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    ProStriker123

    i need to get the arraylist size by .Size() and how much players are in the arraylist its will create a line in scoreboard with their name, ive made a scoreboard but i need that the how much players its will be the same lines as size in the ArrayList scoreboard.addLine("and their name")
     
  2. Offline

    Fuzzybear04

    Use

    Code:java
    1. if(arraylist.size() == 4){ # can be any number
    2. //do stuff
    3. }


    Or use a for loop somewhere
     
  3. Offline

    ProStriker123

    nope i didnt meant like that if its automaticaly gets the number from the arraylist its will check amount there inside the array and its will create lines of scoreboard.addLine() of the amount of the players
     
  4. Offline

    acer5999

    Something like this might work:

    Code:java
    1. for(String playerName : i)
    2. {
    3. yourscoreboard.addLine(playerName);
    4. }
     
  5. Offline

    ProStriker123

    Sur whats does the "i" means the arraylist ?

    ****Bump*****

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 13, 2016
  6. Yes it does
     
Thread Status:
Not open for further replies.

Share This Page