Groovy web console

subscribe to the feed Subscribe
to this


Published 4 months ago by Jurgis Sipols
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
    1. A Map structure that holds String keys and values (key -> value) is given.
    2. By using this structure, get a String List of values that have keys starting with "Bob"
    3. Append these String values in a single String by joining them with ", " and print the result in a single line

Map<String, String> homeworkMap = ["Bob": "Stanley",
                                    "Alice": "Cooper",
                                    "Bobby": "Terminator",
                                    "Cat": "Mouse",
                                    "Bobcat": "Forest"]