Learnerslesson
   JAVA   
  SPRING  
  SPRINGBOOT  
 HIBERNATE 
  HADOOP  
   HIVE   
   ALGORITHMS   
   PYTHON   
   GO   
   KOTLIN   
   C#   
   RUBY   
   C++   




isdisjoint( ) FUNCTION


The 'isdisjoint( )' Function takes the values from both the Sets and checks if no items are present in both Sets. If so, returns true else false.


Example :


x = {"Mohan", "Kriti", "Salim"}
y = {"Sia", "Andrew", "Kriti"}
z = x.isdisjoint(y)
print(z)


Output :



  False

So, in the above code we have created a 'Set' and initialised to the variable 'x'.


x = {"Mohan", "Kriti", "Salim"}

java_Collections

Then what we have done is, put the names, 'Sia', 'Andrew' and 'Kriti' in another set 'y'.


y = {"Sia", "Andrew", "Kriti"}

java_Collections

And used the 'isdisjoint( )' Function next.


z = x.isdisjoint(y)

And since, 'Kriti' is present in both the Sets, 'isdisjoint( )' returns False.


java_Collections

And we get the below output,


False