Java BitSet clone() methodThe clone() method of Java BitSet class is used to make the clone of this BitSet to new BitSet. The clone BitSet has equal to the current original BitSet. The clone bits are exactly the same true value as the original bit set. Syntax:Parameter:NA Returns:The clone() method returns a new clone bit set of the current bit set. Exception:NA Compatibility Version:Java 1.0 and above Example 1Output: Current bitset: {2, 3, 5, 6, 8} Clone bitset: {2, 3, 5, 6, 8} Example 2Making clone of first BitSet to existing second BitSet replaces the existing bit sets of second BitSet with the first bit sets. Output: bitset1:{0, 1, 2, 3, 4} bitset2:{5, 6, 7, 8, 9, 10, 11} bitset1: {0, 1, 2, 3, 4} bitset2 after cloning bitset1{0, 1, 2, 3, 4} Next TopicJava-bitset-cardinality-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