Hello,
got a probem:
class Var {
String name, type;
}
class A {
String flag;
public Map<String,Integer> names = new LinkedHashMap<String, Integer>();
public Map<Var, Integer> paramList = new LinkedHashMap<Var, Integer>();
}
//main
Map<A, Set<B>> map = new LinkedHashMap<A, Set<B>>();
//now I must put stuff inside the map
class Var {
String name, type;
}
class A {
String flag;
public Map<String,Integer> names = new LinkedHashMap<String, Integer>();
public Map<Var, Integer> paramList = new LinkedHashMap<Var, Integer>();
}
//main
Map<A, Set<B>> map = new LinkedHashMap<A, Set<B>>();
//now I must put stuff inside the map
To copy to clipboard, switch view to plain text mode
I need override but a1.equals(a2) if it has equal:
- flag
- Var.type (and not the name)
I overrode by Eclipse just for the flag and added this to the equal:
if (paramList == null) {
if (other.paramList != null)
return false;
// } else if (!paramList.equals(other.paramList))
// return false;
} else if ( !this.getATypeParameters().equals( other.getATypeParameters()) )
return false;
if (paramList == null) {
if (other.paramList != null)
return false;
// } else if (!paramList.equals(other.paramList))
// return false;
} else if ( !this.getATypeParameters().equals( other.getATypeParameters()) )
return false;
To copy to clipboard, switch view to plain text mode
getATypeParameters is my function that return a Set of Var.type. Apparently work; does it make sense? Is it fine?
thanks
Bookmarks