Skip to content

Instantly share code, notes, and snippets.

@tocttou
Created December 12, 2017 11:43
Show Gist options
  • Save tocttou/5c3864c2f956c768fe8b190efb3d8e67 to your computer and use it in GitHub Desktop.
Save tocttou/5c3864c2f956c768fe8b190efb3d8e67 to your computer and use it in GitHub Desktop.
package main
import utils.FrequencyMap
fun main(args: Array<String>) {
val mutableMapOne = mutableMapOf<Int, Int>()
val freqMapOne = FrequencyMap<Int, Int>(mutableMapOne)
freqMapOne.add(1, 3)
freqMapOne.add(1, 2)
freqMapOne.add(Pair(2, 2))
freqMapOne.removeFreq(2, 2)
println("FrequencyMap generated from MutableMap")
for (i in freqMapOne) println(i)
val mutableMapTwo = mutableMapOf<Int, Int>()
FrequencyMap<Int, Int>(mutableMapTwo).add(3, 4)
println("Using methods of FrequencyMap directly on MutableMap")
for (i in mutableMapTwo) println(i)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment