Getting value from list

Discussion in 'Plugin Development' started by SeleXOnEuW, May 9, 2015.

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

    SeleXOnEuW

    Hello, i have list:
    public static List list= new List();

    And i add this to this list:
    Main.list.add(e.getPlayer().getDisplayName(), 15);

    And how i can get this value?

    Main.list.get(getPlayer) doesn't work ;(
     
  2. @SeleXOnEuW You're looking for a Map. Maps can store two pieces of data at a time.
    Map<String, Integer> map = new HashMap<String, Integer>();
    You can use .put(KEY, VALUE) to add it to the map and
    .get(KEY) to get the value you want.
     
Thread Status:
Not open for further replies.

Share This Page