about | help | code help+videos | done | prefs |
Given a String array of items and an integer array of quantities, create a TreeMap that uses Strings for keys and integers for values that contains all of the arrays contents, and then return map.toString(). The TreeMap will automatically sort the keys alphabetically and the toString method will automatically generate the necessary curly braces, commas, and equals signs. Your first line of code should be: Map<String, Integer> map = new TreeMap<String, Integer>(); welcomeback_map_toString(["apples", "bananas"], [3, 5]) → "{apples=3, bananas=5}" welcomeback_map_toString(["oranges", "grapes", "potatoes"], [5, 1, 4]) → "{grapes=1, oranges=5, potatoes=4}" welcomeback_map_toString(["apples", "grapes", "bananas"], [3, 2, 5]) → "{apples=3, bananas=5, grapes=2}" ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy