Set interface

Set interface

hello,,

What is the Set interface?

View Answers

October 25, 2010 at 12:55 PM

hii,

The Set interface provides methods for accessing the elements of a finite mathematicalset. Sets do notallow duplicate elements.


October 25, 2010 at 1:24 PM

Hi,

Here is the example of Set Interface in Java.

import java.util.*;

public class  JavaSetExample
{
    public static void main(String[] args) 
    {
        System.out.println("Set Example in Java!");

        // Create HashSet Object
        Set set = new HashSet(); 
        // Add elements to the HashSet object
        set.add("Java"); 
        set.add("JSP"); 
        set.add("Servlet"); 
        set.add("EJB"); 
        set.add("JPA"); 
        set.add("JSF"); 
        //Iterate set
        Iterator it = set.iterator(); 
        while (it.hasNext()) { 
        //Get it
        String element = (String)it.next(); 
            System.out.println(element);
        } 

    }
}

Thanks









Related Tutorials/Questions & Answers:
Set interface
Set interface  hello,, What is the Set interface?   hii,ADS_TO_REPLACE_1 The Set interface provides methods for accessing the elements..., Here is the example of Set Interface in Java.ADS_TO_REPLACE_2 import
Set Interface
Set Interface       The Set interface extends the Collection interface.... It permits a single element to be null. The Set interface contains only methods
Advertisements
is set interface synchronize by default???????
is set interface synchronize by default???????  is set interface synchronize by default??????? an whether list is syncrhronized by default
Null value when i set interface object in form controller - Spring
Null value when i set interface object in form controller   Hi all, i am very new about spring and hibernate. i got null value when i set interface object in form Controller. public void setOHBillManager(OHBillManager
interface
interface   what is the use of marking interface
interface.
interface.  Write short note on interface.   Please visit the following link: Java Interface
interface
interface  will the interface implements a interface   Hi Friend, No. Interface can extends another interface but cannot implements it, because interface will not contain the implementation. Thanks
INTERFACE
INTERFACE  how interface support multiple inheritance in java
interface
interface   Hi I have interface in that interface 3 methods are there , after some days client said that,i want to add one more method in that interface ,so how can add 4 method so that the implemented class did not affect
interface
interface  can we extend interface?   Hi Friend, Yes an interface can be extended by other interface like using extends keyword interface A{ } interface B extends A{ } For Example: interface IntefaceA { void
interface
interface  what the use of interface?   An interface is one... variables.Any class can implement(inherit)the interface and make use... is achieved by using the interface (by implementing more than one interface at a time
interface
interface  What is marker interface ?? what is its use in java programming?? is this us in programming ??Explain is implementation with code
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
interface
interface  develop a library interface which has drawbook(),returnbook()(with fine),checkstatus() and reservebook() methods.all the methods tagged with public
Interface
for Interface in java? and want to know why they used interface instead of multiple inheritance? Thanks in advance   An interface is one which has abstract... implement(inherit)the interface and make use of the methods(functions
interface
interface  why do we need interface in java..if it`s usefull for to obtain multiple inheritance in the sense how it gonna be achieved...and i can...)...the y we need interface...THis is question often i heard from my developer
Interface
Interface  I need to implement the interface without overriding its method and also don't use abstract class for this. How to do
interface
interface  What is the exact use of interface in real time scenario? some people says that interface provides multiple inheritance. Is it true...; Through interface, we can achieve the multiple inheritance. Java does
Java set example
Java set example In this section you will learn about set interface in java... to add duplicate elements in the set. The set interface has method which... collection. Example of java set interface. import java.util.Iterator; import
Interface
Interface  1.Create an interface names ShapeInterface that has two... class a.Rectangle that uses the interface b.Circle that uses the interface and abstract class   interface ShapeInterface{ int l=0,b=0; public
Interface
Interface  1.Create an interface names ShapeInterface that has two... class a.Rectangle that uses the interface b.Circle that uses the interface and abstract class   interface ShapeInterface{ int l=0,b=0; public
Interface
Interface  Declare an Interface called property containting a method compute price to compute &return the price.The inerface is to be implemented by follwaing two class (1)Bungalow&(2)Flat both the lasses have following
Java Set iterator with example
Java Set Interface keeps the data without duplicate value. Its one subtype... Set Iterator import java.util.*; public class setiterator { public static void main(String[] args) { Set s = new TreeSet(); s.add(1000); s.add
Java Set Iterator
Set Interface keeps the data without duplicate value. Its one subtype... data. It uses iterator() method to traverse the data Java Set Iterator...(String[] args) { Set s = new HashSet(); s.add("car
Interface HttpServletRequest methods
Description: The interface HttpServletRequest called from the javax.servlet.http package which extends the ServletRequest interface.The HttpServletRequest object created by the servlet container and passes as an argument
How to store unique values in Java using Set?
Store unique values in Java using Set interface In this section we will discuss about the Set interface in Java which is designed to store unique values. We will show you how to store unique values in Java using Set? The Set interface
How to store unique values in Java using Set?
Store unique values in Java using Set interface In this section we will discuss about the Set interface in Java which is designed to store unique values. We will show you how to store unique values in Java using Set? The Set interface
Abstract and Interface
Abstract and Interface  What is interface? When time is most suitable for using interface? Why we use interface instead of abstract? What is the differences between abstract and interface?   An interface defines a set
What is an interface?
What is an interface?  What is an interface
Can an Interface implement another Interface?
Can an Interface implement another Interface?   Hi, Can an Interface implement another Interface? Thanks
Can an Interface extend another Interface?
Can an Interface extend another Interface?   Hi, Can an Interface extend another Interface? thanks
ServletRequest interface
ServletRequest interface   What is new in ServletRequest interface
about interface - Java Beginners
of the given line Set si=new HashSet(); Problem is that Set is an interface and HashSet is a class... so how instantiation of interface is possible..or..what... static void main(String args[]){ Set set = new HashSet(); Set dups = new HashSet
Map interface
Map interface  What is the Map interface
Java interface
Java interface  What is the List interface
List interface
List interface  What is the List interface
Prepared Statement Set Big Decimal
Prepared Statement Set Big Decimal   ... the big decimal and how can be set it in the database table by using the PreparedStatement interface of java.sql package. But here arises a question, what is big
Interface implimentation
Interface implimentation  How to impliment an interface For Achieveing MVC & loosCupling in Any Project
callable interface
callable interface  When we use the callable interface instated of runable interface
Java Interface
Java Interface  Can an Interface have an inner class?  Yes, interface can have inner class. for example- public interface gyan { static...("in interface"); }; public static void main(String args
SET and SELECT
SET and SELECT  hello, What is difference between SET & SELECT in sql????   hii,ADS_TO_REPLACE_1 SET : The set statement is used to the update query. SELECT : The select statement is used to display the all
Java interface
Java interface  What must a class do to implement an interface?  It must provide all of the methods in the interface and identify the interface in its implements clause
Java interface
Java interface  What modifiers may be used with an interface declaration
logfile interface
logfile interface  How to create logfile interface for programs in java
Marker interface
Marker interface  what is a marker interface? what is its significance
Abstract and Interface
Abstract and Interface  what is the difference between Abstract and Interface accurateatly
null interface
null interface   what is the null interface and what is the use of it in real java project ?   Hi Friend, A null interface is an interface without any methods.Is also known as Marker interface. Null interfaces are used
marked interface
marked interface  how jvm work with marked interface?(that means how it will know its behaviour with out any methods)   Hi, Learn it at Market Interface in Java tutorial page.ADS_TO_REPLACE_1 Thanks
interface_querry
interface_querry  By using interface we have to implement all unimplemented methods into our class, even though we are not using all of methods, what is the alternative
Interface in java
Interface in java  An Interface method implemented in more than one different class with same method name. To avoid overriding of methods, we use ObjectReference for that class

Ads