Comparing two Collections in Java

前端 未结 7 1475
孤独总比滥情好
孤独总比滥情好 2020-12-15 23:30

I have two Collections in a Java class.The first collection contains previous data, the second contains updated data from the previous collection.

I would like to c

7条回答
  •  一生所求
    2020-12-16 00:15

    public static boolean isEqualCollection(java.util.Collection a,
                                            java.util.Collection b)
    

    Returns true if the given Collections contain exactly the same elements with exactly the same cardinalities.

    That is, iff the cardinality of e in a is equal to the cardinality of e in b, for each element e in a or b.

    Parameters:

    • the first collection, must not be null
    • the second collection, must not be null

    Returns: true iff the collections contain the same elements with the same cardinalities.

提交回复
热议问题