I need to initialize a like Map x<Apartment,Vector<Expense>> it allows me if I @override the Map methods
Description Resource Path Location Type
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.isEmpty() Repository.java /proj_individual/src/repo line 12 Java Problem
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.size() Repository.java /proj_individual/src/repo line 12 Java Problem
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.keySet() Repository.java /proj_individual/src/repo line 12 Java Problem
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.remove(Object) Repository.java /proj_individual/src/repo line 12 Java Problem
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.entrySet() Repository.java /proj_individual/src/repo line 12 Java Problem
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.putAll(Map<? extends Apartment,? extends Vector<Expense>>) Repository.java /proj_individual/src/repo line 12 Java Problem
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.values() Repository.java /proj_individual/src/repo line 12 Java Problem
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.clear() Repository.java /proj_individual/src/repo line 12 Java Problem
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.get(Object) Repository.java /proj_individual/src/repo line 12 Java Problem
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.containsKey(Object) Repository.java /proj_individual/src/repo line 12 Java Problem
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.containsValue(Object) Repository.java /proj_individual/src/repo line 12 Java Problem
The type new Map<Apartment,Vector<Expense>>(){} must implement the inherited abstract method Map<Apartment,Vector<Expense>>.put(Apartment, Vector<Expense>) Repository.java /proj_individual/src/repo line 12 Java Problem
But I read on the internet that Map isn’t a interface, it is a class, am I doing it wrong, or this is the way it has to be done?
Mapis an interface (as the javadoc says — javadoc should be your reference, rather than the Internet). You need to choose an implementation (HashMap being the most often used one, but there are other implementations, with other characteristics).You should also forget about Vector. It shouldn’t be used anymore. Use List as a type, and ArrayList as an implementation (there are also other List implementations, but ArrayList is almost always what you want):
or simply
if you’re under Java 7.