#Having a hard time understanding maps

8 messages · Page 1 of 1 (latest)

brave vale
#

I'm almost 100% positive that this config yml is considered a map.
My problem is I'm not entirely sure how to get the values of the map?

HashMap configMaterialMap = config.getMapList("Consumables");
Consumables:
  MUSHROOM_STEW: 4
  APPLE: 5
  GOLDEN_APPLE: 10
  CARROT: 15
  POTATO: 20
untold tideBOT
#

This post has been reserved for your question.

Hey @brave vale! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

devout prism
#

yeah, that would be a map. actually getting a map from the yaml is another story though, seems like that parsing is the part you're stuck on?

fading kettle
#

Are you stuck on retrieving data from the map? Hash maps requires you to use the .get() method with the key as the param.

untold tideBOT
devout prism
#

regardless, check the collections api > maps page there out

#

and generics while you're at it, don't use raw types