我试图为我的treemap(内存)使用firstKey()方法.我的代码看起来像:
import java.util.*;
//Code in the middle.
System.out.println(memory.firstKey());
Run Code Online (Sandbox Code Playgroud)
但它给了我这个错误:
GameLogic.java:276: cannot find symbol
symbol : method firstKey()
location: interface java.util.Map<java.lang.Integer,java.lang.Character>
System.out.println(memory.firstKey());
^
Run Code Online (Sandbox Code Playgroud)
所有建议都赞赏.如果我也使用lastKey(),也会发生同样的错误.