Java BitSet intersects() methodThe intersects(BitSet set) method of Java BitSet class returns Boolean value true or false on the basis of whether parameter BitSet has intersected with this BitSet or not. It returns true if the specified BitSet set is also true in this BitSet. Syntax:Parameter:
Returns:It returns a Boolean value true or false on the basis of whether parameter BitSet has intersected with this BitSet or not. Exception:NullPointerException - If null parameter will pass in the method. Compatibility Version:Java 1.4 and above Example 1Output: bitset1: {1, 2, 3, 4} bitset2: {1, 2, 6, 7} bitset3: {5, 6, 7, 8} intersected result between bitset1 and bitset2: true intersected result between bitset1 and bitset3: false Example 2This method throws a NullPointerException if we pass a null parameter. Output: Exception in thread "main" java.lang.NullPointerException at java.util.BitSet.intersects(Unknown Source) at BitSetEntersectsExample2.main(BitSetEntersectsExample2.java:14) bitset1: {1, 2, 3, 4} Next TopicJava-bitset-hashcode-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