Verifies that {@code b} is an instance of the type scheme {@code a}.
339613
public static boolean isInstance(Type a, Type b) {
    if (a instanceof Class<?>) {
      return a.equals(b);
    } else if (a instanceof GenericArrayType) {
      if (b instanceof GenericArrayType) {
        return isInstance(
            ((GenericArrayType) a).getGenericComponentType(),
            ((GenericArrayType) b).getGenericComponentType());
      } else {
        return false;
      }
    } else if (a instanceof ParameterizedType) {
      if (!(b instanceof ParameterizedType)) {
        return false;
      }
      ParameterizedType parameterizedTypeA = (ParameterizedType) a;
      ParameterizedType parameterizedTypeB = (ParameterizedType) b;
      Type[] actualTypeArgumentsA = parameterizedTypeA.getActualTypeArguments();
      Type[] actualTypeArgumentsB = parameterizedTypeB.getActualTypeArguments();
      if (!parameterizedTypeA.getRawType().equals(parameterizedTypeB.getRawType()) ||
          actualTypeArgumentsA.length != actualTypeArgumentsB.length) {
        return false;
      }
      for (int i = 0; i < actualTypeArgumentsA.length; i++) {
        if (!isInstance(actualTypeArgumentsA[i], actualTypeArgumentsB[i])) {
          return false;
        }
      }
      return true;
    } else if (a instanceof TypeVariable<?>) {
      TypeVariable<?> typeVariable = (TypeVariable<?>) a;
      for (Type bound : typeVariable.getBounds()) {
        return isAssignableFrom(bound, b);
      }
      return true;
    } else if (a instanceof WildcardType) {
      WildcardType wildcardType = (WildcardType) a;
      for (Type lowerBound : wildcardType.getLowerBounds()) {
        if (!isAssignableFrom(b, lowerBound)) {
          return false;
        }
      }
      for (Type upperBound : wildcardType.getUpperBounds()) {
        if (!isAssignableFrom(upperBound, b)) {
          return false;
        }
      }
      return true;
    }
    throw new IllegalStateException();
  }
733594
@Requires("e != null")
  @Ensures("result != null")
  private Boolean isContractedType(TypeElement e) {
    Boolean result = Boolean.FALSE;

    /* The current element has contracts on its annotations. */
    result = hasContracts(e.getAnnotationMirrors());

    /* Checks superclass. */
    if (!result) {
      Element superclass =
          utils.typeUtils.asElement(e.getSuperclass());
      if (superclass != null) {
        /* Scans up in the syntax tree looking for contract annotations. */
        result = superclass.accept(this, null);
      }
    }

    /* Checks interfaces. */
    if (!result) {
      Collection<? extends TypeMirror> interfaces = e.getInterfaces();
      for (TypeMirror i : interfaces) {
        Element iface = utils.typeUtils.asElement(i);
        result = iface.accept(this, null);
        if (result) {
          break;
        }
      }
    }

    /* Scan the enclosed elements of this. */
    if (!result) {
      List<? extends Element> enclosed = e.getEnclosedElements();
      for (Element element : enclosed) {
        result = element.accept(this, null);
        if (result) {
          break;
        }
      }
    }

    return result;
  }
484086
public static <A, B> These<A, B> b(B b) {
        return new _B<>(b);
    }
297978
private static boolean isAssignableFrom(GenericArrayType type1, Class<?> type2) {
        return type2.isArray() && isAssignableFrom(Reflections.getRawType(type1.getGenericComponentType()), type2.getComponentType());
    }
221242
public boolean isSubtypeOf(JvmType type) {
		if (type == null) {
			throw new IllegalArgumentException("type may not be null");
		}
		// TODO interfaces don't inherit from non-interfaces, primitives, arrays, object
		// A final type does not have any subtypes
		// check for type == this.type
		LightweightTypeReference other = owner.toPlainTypeReference(type);
		boolean result = other.isAssignableFrom(this);
		return result;
	}
301778
public static boolean isSameCompilationUnit(ClassNode a, ClassNode b) {
        CompileUnit cu1 = a.getCompileUnit();
        CompileUnit cu2 = b.getCompileUnit();
        return cu1 != null && cu1 == cu2;
    }
842147
private boolean isValidTreeType(Tree t) {
    if (t instanceof LambdaExpressionTree) {
      return true;
    }
    if (t instanceof ClassTree) {
      NestingKind nestingKind = ASTHelpers.getSymbol((ClassTree) t).getNestingKind();
      return nestingKind.equals(NestingKind.ANONYMOUS) || nestingKind.equals(NestingKind.LOCAL);
    }
    return false;
  }
1241708
public boolean isInterfaceOrUnion(Type type) {
        Optional<TypeDefinition> typeDefinition = getType(type);
        if (typeDefinition.isPresent()) {
            TypeDefinition definition = typeDefinition.get();
            return definition instanceof UnionTypeDefinition || definition instanceof InterfaceTypeDefinition;
        }
        return false;
    }
293037
public static boolean containsIgnoreCase(CharSequence a, CharSequence b) {
        return contains(a, b, AsciiCaseInsensitiveCharEqualityComparator.INSTANCE);
    }
632742
function (a, b) {
        if (a === b) {
            return true;
        }
        if (typeof a !== typeof b) {
            return this._alike(a, b);
        }
        return this._objectLike(a, b);
    }
336563
private static boolean identityEquals(Object[] a, Object[] a2) {
        if (a == a2) {
            return true;
        }
        if (a == null || a2 == null) {
            return false;
        }

        int length = a.length;
        if (a2.length != length) {
            return false;
        }

        for (int i=0; i<length; i++) {
            if (a[i] != a2[i]) {
                return false;
            }
        }

        return true;
    }
324981
protected boolean areNodesEqualForInlining(Node n1, Node n2) {
    /* Our implementation delegates to the compiler. We provide this
     * method because we don't want to expose Compiler to PeepholeOptimizations.
     */
    checkNotNull(compiler);
    return compiler.areNodesEqualForInlining(n1, n2);
  }
730324
private static boolean areMethodNameAndParameterTypesEqual(Method methodA, Method methodB) {
        if (!methodA.getName().equals(methodB.getName())) {
            return false;
        }
        Class<?>[] methodAParameterTypes = methodA.getParameterTypes();
        Class<?>[] methodBParameterTypes = methodB.getParameterTypes();
        if (methodAParameterTypes.length != methodBParameterTypes.length) {
            return false;
        }
        for (int i = 0; i < methodAParameterTypes.length; i++) {
            if (!methodAParameterTypes[i].equals(methodBParameterTypes[i])) {
                return false;
            }
        }

        return true;
    }
90477
def assertSameType(a, b):
    
    if not isinstance(b, type(a)):
        raise NotImplementedError("This operation is only supported for " \
            "elements of the same type. Instead found {} and {}".
                format(type(a), type(b)))
1337599
public static boolean isAbstract(TypeRef  typeRef) {
        DefinitionRepository repository =  DefinitionRepository.getRepository();
        TypeDef def = repository.getDefinition(typeRef);
        if (def == null && typeRef instanceof ClassRef) {
            def = ((ClassRef)typeRef).getDefinition();
        }
        return def != null ? def.isAbstract() : false;
    }
641558
public static boolean contains(CharSequence a, CharSequence b) {
        return contains(a, b, DefaultCharEqualityComparator.INSTANCE);
    }
338210
public static void assertNotEqual(Object a, Object b) {
        assertNotEqual(a, b, a + " should not equal to " + b);
    }