How to Add items to Queue sitting in a Scala mutable.hashmap?
I tried this:
val hashMapUserListeners: mutable.HashMap[UUID, mutable.Queue[UUID]]
hashMapUserListeners.get(uuid) += uuid2
But got this error:
[error]Expression does not convert to assignment because receiver is not assignable.
[error]hashMapUserListeners.get(uuid) += uuid2
Actual Code Snippet:
def listenUserStatus(actorRef: ActorRef, message: SocketParsedMessage)={
(message.data \ "userId").validate[UUID] match {
case s: JsSuccess[UUID] => {
if(hashMapUserListeners.contains(s.get)){
if(!hashMapUserListeners.get(s.get).contains(hashMapA2U.get(actorRef))) {
hashMapUserListeners.get(s.get) += hashMapA2U.get(actorRef)
}
} else{
hashMapUserListeners += (s.get -> new mutable.Queue[UUID]())
}
}
case e: JsError => actorRef ! SocketParsedMessage(
AllowedSocketMessageTypes.LISTEN_USER_STATUS, Json.obj(
"success" -> false,
"message" -> "UserId not provided with request"
))
mutable.Queue[UUID]) is mutable.