Hallo! Ich habe erst kürzlich mit dem Programmieren angefangen, stelle mich daher möglicherweise ein wenig dumm an. Jedenfalls habe ich ein Problem in folgender Methode:
Als Fehler werden die Typparameter Set<K> und Entry<K, V> angezeigt. Jeweils mit [...] cannot be resolved to a type.
Hier noch einmal die Klasse Entry:
Und das Interface ReadableMap:
Ich stehe leider total auf dem Schlauch und wäre sehr dankbar für jegliche Hilfe.
Also danke schonmal im Vorraus!
Java:
public static void printEntries(ReadableMap<String, Integer> a)
{
Set<K> b = a.keysAsSet();
try{
for(Entry<K, V> i : b)
{
if(i.getKey() != null)
{
getOrThrow(i.getKey());
}
System.out.println(i.getKey() + ": " + getOrThrow(i.getKey()));
}
}
catch(UnknownKeyException z)
{
throw new UnknownKeyException();
System.out.println("Eine UnknownKeyException ist aufgetreten.");
}
}
Als Fehler werden die Typparameter Set<K> und Entry<K, V> angezeigt. Jeweils mit [...] cannot be resolved to a type.
Hier noch einmal die Klasse Entry:
Java:
public class Entry<K, V> {
private K key;
private V value;
public Entry(K key, V value)
{
this.key = key;
this.value = value;
}
public K getKey()
{
return this.key;
}
public V getValue()
{
return this.value;
}
}
Und das Interface ReadableMap:
Java:
import java.util.Set;
public interface ReadableMap<K, V> {
public abstract V getOrThrow(K key) throws UnknownKeyException;
public abstract ImmutableMap<K, V> asImmutableMap();
public Set<K> keysAsSet();
}
Ich stehe leider total auf dem Schlauch und wäre sehr dankbar für jegliche Hilfe.
Also danke schonmal im Vorraus!