JAL-4353 Preserve the user given 'linkedId' with ArgValue, to help with deciding...
[jalview.git] / src / jalview / bin / argparser / Arg.java
index cdb29bf..9a05c9f 100644 (file)
@@ -681,24 +681,22 @@ public enum Arg
     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;
       }