11:10 pm - Saturday May 27, 2017

Dynamically typesafe view in collection using public static Collection checkedCollection(Collection c, Classtype)

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

                          The method is used to get a dynamically typesafe view of the specified collection.

Example Program

import java.util.Collections;

import java.util.Collection;

import java.util.ArrayList;

public class collectionCheckedCollection

{

	public static void main(String[] args)

	{

		ArrayList<String> d = new ArrayList<String>();

		d.add("Data");

		d.add("System");

		Collection<String> v;

		v = Collections.checkedCollection(d, String.class);

		System.out.println(" Safe view : " + v);

	}

}

Output

   Safe view : [Data, System]

 

BACK

Filed in: Java Examples

Comments are closed.