(36, 32): Unresolved reference: getOrDefault (42, 34): Unresolved reference: compute Cannot infer a type for this parameter. Please specify it explicitly. When dealing with "mutableMapOf()" package com.treecat.kappa.emotecounter import com.treecat.kappa.EmoteParser import org.pircbotx.twitch.beans.TwitchEmote import org.quartz.JobBuilder import org.quartz.SimpleScheduleBuilder import org.quartz.TriggerBuilder import org.quartz.impl.StdSchedulerFactory import java.util.* object DefaultCache { val cache = Cache(); get } class Cache { val emotesPerMinute : MutableMap> = Collections.synchronizedMap(mutableMapOf>()); get// channel, emote, quantity val emotesLastSecond : MutableMap> = Collections.synchronizedMap(mutableMapOf>()); get // channel, emote, quantity init { val scheduler = StdSchedulerFactory.getDefaultScheduler() scheduler.start() scheduler.context.put("emoteCache", this) val toEmotesPerEachSecond = TriggerBuilder.newTrigger().withSchedule(SimpleScheduleBuilder.repeatSecondlyForever()).build() scheduler.scheduleJob(JobBuilder.newJob(MoveJob::class.java).build(), toEmotesPerEachSecond) } fun getChannelStatistics(channel: String): Map { return emotesPerMinute[channel]?: mapOf() } fun findEmoteByChannel(channel: String, emoteName: String): Long { return emotesPerMinute.getOrDefault(channel, HashMap())[emoteName]!! } fun cache(channel: String, emotes: List) { synchronized(emotesLastSecond) { emotes.forEach { emote -> emotesLastSecond.compute(channel) { k, v -> val map : MutableMap = v ?: mutableMapOf() var amount = map[EmoteParser.emotes[emote.id]] ?: 0 amount += emote.locations.size if (EmoteParser.emotes[emote.id] != null) { map.put(EmoteParser.emotes[emote.id]!!, amount) } map } } } } fun cache(channel: String, message: String) { synchronized(emotesLastSecond) { emotesLastSecond.compute(channel) { k, v -> val map : MutableMap = v ?: mutableMapOf() var amount = map[message] ?: 0 amount += 1 map.put(message, amount) map } } } }