2:15 am - Tuesday October 24, 2017

returns the empty set (immutable) emptySet() method

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044

BACK

This Program used to return rhe empty set values using empty() set method.

Example Program


import java.util.Collections;
import java.util.Set;

public class EmptySet {

	public static void main(String[] args) {
		Set<String> MyEmptySet = Collections.<String> emptySet();
		System.out.println("Empty Set:" + MyEmptySet);

	}
}

 

Output:

 

Empty Set:[]

 

Explanation:

 

Collections.emptySet() method returns the empty set (immutable). This set is serializable.

 

Parameter: NA

 

Return value:NA

 

Exception: NA

 

BACK

 

Filed in: Z-A All Java Codes

Comments are closed.