How to check if there's [amount] of string's in an array list?

Discussion in 'Plugin Development' started by HyrulesLegend, Nov 1, 2013.

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

    HyrulesLegend

    Any ideas?
     
  2. Offline

    MrSparkzz

    Code:java
    1. arrayName.size();
     
  3. Offline

    Drkmaster83

    Code:
    ArrayList<String> stringList = new ArrayList<String>();
    stringList.add("Hi, sexy!");
    stringList.add("How ya doing?");
    System.out.println(stringList.size);
    
    Should print out 2, though the amount of arrays in a String array would be [1], I believe.
     
  4. Offline

    MrSparkzz

    You cannot use .length for ArrayLists.
     
  5. Offline

    Drkmaster83

    This is what I get for not using an IDE!! Curse you, memory. Edited.
     
  6. Offline

    MrSparkzz

    It'd be .size not .getSize haha. Silly non-IDE user ;)

    But it should be .getSize ... Not sure why it's not :/
     
    Drkmaster83 likes this.
  7. Offline

    Drkmaster83

    Normally, I use my IDE. But I'm feeling lazy and a bit tired... Also, I hate how the IDE code translates to the box. It foops up the formatting. Edited... again.
     
    MrSparkzz likes this.
Thread Status:
Not open for further replies.

Share This Page