I have been writing this line:
Map s_AvailableGameTables = Collection.synchronizedMap(new TreeMap());
And got the following error: cannot find symbol
symbol: method synchronizedMap(java.util.TreeMap) location: interface java.util.Collection
Although I wrote
import java.util.*;
import java.util.TreeMap;
import java.util.Collections;
import java.util.Map;
What is the reason for that?
Thanks
It's a simple typo. It should be Collections
, not Collection
.
Try,
Map s_AvailableGameTables = Collections.synchronizedMap(new TreeMap());
A synchronized TreeMap is rather slow. It's probably better to use ConcurrentSkipListMap if you want a navigatable map that supports concurrency.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.