8:12 am - Tuesday November 21, 2017

HashSet example program for boolean addAll(Collection c)

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
/**
@Description : HashSet example program for boolean contains(Object o)
@Author : candidjava.com
 */
import java.util.HashSet;

public class hshst {
	public static void main(String[] args) {
		HashSet myset = new HashSet();
		myset.add("Learning");
		myset.add("Easy");
		myset.add("Simply");
		boolean exist = myset.contains("Simply");
		System.out.println("Is the element 'Simply' exists: " + exist);
	}
}

Output

Is the element ‘Simply’ exists: false

BACK

Filed in: Z-A All Java Codes

Comments are closed.