Skip to content

Instantly share code, notes, and snippets.

@Nickstr
Created June 12, 2014 13:49
Show Gist options
  • Save Nickstr/0f2e728b0a4a3020c816 to your computer and use it in GitHub Desktop.
Save Nickstr/0f2e728b0a4a3020c816 to your computer and use it in GitHub Desktop.
// Input: 1 2 2 5
// Issue; println(pair), line 12, is not being printed in the console
def setupNormalRegions(regions: String) {
// Remove spaces from input
val groupedRegions: String = regions.replaceAll(" ", "");
// Group regions by 2 numbers (id, value) and loop over them
groupedRegions.grouped(2).map { pair =>
// Trying to get pair here for testing
println(pair)
// Create id and Value
val id :: value :: Nil = pair.toList
// Create new Region object
val region = new NormalRegion(id.toInt, value.toInt)
// Add Region to map
map.addRegion(region);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment