1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.collections15.list;
17
18 import java.util.List;
19
20
21 /***
22 * After the port to JDK5.0, this class should be deprecated in a future release.
23 *
24 * Decorates another <code>List</code> to validate that elements
25 * added are of a specific type.
26 * <p>
27 * The validation of additions is performed via an instanceof test against
28 * a specified <code>Class</code>. If an object cannot be added to the
29 * collection, an IllegalArgumentException is thrown.
30 *
31 * @deprecated Useless after port to JDK5.0
32 * @since Commons Collections 3.0
33 * @version $Revision: 1.1 $ $Date: 2005/05/03 22:45:38 $
34 *
35 * @author Stephen Colebourne
36 * @author Matthew Hawthorne
37 */
38 public class TypedList {
39
40 /***
41 * Factory method to create a typed list.
42 * <p>
43 * If there are any elements already in the list being decorated, they
44 * are validated.
45 *
46 * @param list the list to decorate, must not be null
47 * @param type the type to allow into the collection, must not be null
48 * @throws IllegalArgumentException if list or type is null
49 * @throws IllegalArgumentException if the list contains invalid elements
50 */
51 public static <T> List<T> decorate(List<T> list, Class type) {
52 return list;
53
54 }
55
56 /***
57 * Restrictive constructor.
58 */
59 protected TypedList() {
60 }
61
62 }