Treemap FirstKey() importing error

java, treemap

Solution

I think you have declared

Map map = new TreeMap();

you need to instead do

TreeMap map = new TreeMap(); //OR SortedMap map = new TreeMap() 
map.firstKey();

Because `firstKey()` is a method which exists in `TreeMap` which is not defined in `Map` contract (or interface)

Problem

I am trying to use the firstKey() method for my treemap (memory). My code looks like: ``` import java.util.*; //Code in the middle. System.out.println(memory.firstKey()); ``` It however gives me this error: ``` 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()); ^ ``` All advice appreciated. The same error happens if I use lastKey() as well.

Original source