Java BitSet equals() methodThe equals() method of Java BitSet class is used to compare the current BitSet object with specified object. The result of comparing BitSet bit with BitSet object returns true if and only if the specified object is not null and the set of BitSet object must have exactly same set of bit set to true as this BitSet. For every non-negative int index i, the followinh condition: Syntax:Parameter:
Returns:This method returns true if the objects are the same as current bit set otherwise, returns false. Exception:NA Compatibility Version:Java 1.0 and above Example 1Output: bitset:{0, 1, 2, 3, 4} object:{0, 1, 2, 3, 4} BitSet is equal to specified Object Example 2The equals() method return false, if the length of sets of BitSet are not equal to the length of BitSet object or even all the index of BitSet are not equals to the index of BitSet object. Output: bitset1:{0, 1, 2, 3, 4, 5} bitset2:{0, 1, 2, 3, 5} object:{0, 1, 2, 3, 4} BitSet1 is not equal to specified Object BitSet2 is not equal to specified Object Next TopicJava-bitset-clone-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India