LazyCompositeData.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:openjdk-jdk10 作者:
/**
 * Compares two CompositeTypes and returns true if
 * all items in type1 exist in type2 and their item types
 * are the same.
 * @param type1 the base composite type
 * @param type2 the checked composite type
 * @return {@code true} if all items in type1 exist in type2 and their item
 *         types are the same.
 */
protected static boolean isTypeMatched(CompositeType type1, CompositeType type2) {
    if (type1 == type2) return true;

    // We can't use CompositeType.isValue() since it returns false
    // if the type name doesn't match.
    Set<String> allItems = type1.keySet();

    // Check all items in the type1 exist in type2
    if (!type2.keySet().containsAll(allItems))
        return false;

    return allItems.stream().allMatch(
        item -> isTypeMatched(type1.getType(item), type2.getType(item))
    );
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号