Set contains in java

Code examples

0
0

set contains in java

public class HashSetDemo {
   public static void main(String args[]) {
      
      // create hash set
      HashSet <String> newset = new HashSet <String>();

      // populate hash set
      newset.add("Learning"); 
      newset.add("Easy");
      newset.add("Simply");  

      // check the existence of element
      boolean exist = newset.contains("Simply");

      System.out.println("Is the element 'Simply' exists: "+ exist);
   }    
}

Similar pages

Similar pages with examples

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................