문제

I am trying to create a trigram model using LinkedHashMap> where Entry is the entry of last inputed bigram (whose structure is: LinkedHashMap

Now the problem is, being a map it does not store multiple keys (overwrites the existing key-value pair with new key-value pair for existing key).

I am not sure whether a multimap will be useful for this or not? If so, how?

도움이 되었습니까?

해결책

Every collections that implements Map interface keeps it's keys in Set implementation. Set can not keep multiple values.

Multimap is just a Map<Key, Collection<Value>>. It allows to keep multiple values under one key.

Read more about Maps.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top