FileDocCategorySizeDatePackage
ErasureDemo.javaAPI DocExample2106Mon Nov 24 01:33:02 GMT 2003oreilly.hcj.tiger

ErasureDemo

public class ErasureDemo extends Object
Implements a manager of lists that stores the lists by key.

Fields Summary
private static List
someList
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

			someList = new ArrayList<Integer>();
			someList.add(new Integer(123));
			someList.add(new Integer(456));
			someList.add(new Integer(789));
			
		try {
			List list = (List)ErasureDemo.class.getDeclaredField("someList").get(null);
			list.add(new String("Hello"));
			for (Object element : list) {
				((Integer)element).intValue();
			}
	
		} catch (final Exception ex) {
			System.out.println();
			ex.printStackTrace();
		}

		try {
			List list2 = new ArrayList(); 
			list2.add(new Integer(3));
			list2.add(new String("Hello"));
	
			Class[] paramTypes = new Class[] {List.class};
			Object[] methargs = new Object[] {list2};
			Method meth = ErasureDemo.class.getDeclaredMethod("someMethod", paramTypes);
			meth.invoke(null, methargs);
		} catch (final Exception ex) {
			System.out.println();
			ex.printStackTrace();
		}
	
public static voidsomeMethod(java.util.List list)

		for (Integer element : list) {
			element.intValue();
		}