Extract createTreeSetWithMapValues(...). DRY.