return this.types;
}
- public boolean hasType(Type t)
+ public boolean sharesType(Arg a)
{
- for (Type type : getTypes())
- {
- if (type == t)
- {
- return true;
- }
- }
- return false;
+ return this.hasType(a.getTypes());
}
- public boolean sharesType(Arg a)
+ public boolean hasType(Type... types)
+ {
+ Set<Type> typesSet = new HashSet<>(Arrays.asList(types));
+ return this.hasType(typesSet);
+ }
+
+ public boolean hasType(Set<Type> typesSet)
{
- List<Type> aTypes = Arrays.asList(a.getTypes());
for (Type type : getTypes())
{
- if (aTypes.contains(type))
+ if (typesSet.contains(type))
{
return true;
}