1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portal.kernel.util;
24  
25  import java.util.Collection;
26  import java.util.Iterator;
27  import java.util.List;
28  import java.util.ListIterator;
29  
30  /**
31   * <a href="ListWrapper.java.html"><b><i>View Source</i></b></a>
32   *
33   * @author Brian Wing Shun Chan
34   *
35   */
36  public class ListWrapper<E> implements List<E> {
37  
38      public ListWrapper(List<E> list) {
39          _list = list;
40      }
41  
42      public boolean add(E o) {
43          return _list.add(o);
44      }
45  
46      public void add(int index, E element) {
47          _list.add(index, element);
48      }
49  
50      public boolean addAll(Collection<? extends E> c) {
51          return _list.addAll(c);
52      }
53  
54      public boolean addAll(int index, Collection<? extends E> c) {
55          return _list.addAll(index, c);
56      }
57  
58      public void clear() {
59          _list.clear();
60      }
61  
62      public boolean contains(Object o) {
63          return _list.contains(o);
64      }
65  
66      public boolean containsAll(Collection<?> c) {
67          return _list.containsAll(c);
68      }
69  
70      public E get(int index) {
71          return _list.get(index);
72      }
73  
74      public int indexOf(Object o) {
75          return _list.indexOf(o);
76      }
77  
78      public boolean isEmpty() {
79          return _list.isEmpty();
80      }
81  
82      public Iterator<E> iterator() {
83          return _list.iterator();
84      }
85  
86      public int lastIndexOf(Object o) {
87          return _list.lastIndexOf(o);
88      }
89  
90      public ListIterator<E> listIterator() {
91          return _list.listIterator();
92      }
93  
94      public ListIterator<E> listIterator(int index) {
95          return _list.listIterator(index);
96      }
97  
98      public boolean remove(Object o) {
99          return _list.remove(o);
100     }
101 
102     public E remove(int index) {
103         return _list.remove(index);
104     }
105 
106     public boolean removeAll(Collection<?> c) {
107         return _list.removeAll(c);
108     }
109 
110     public boolean retainAll(Collection<?> c) {
111         return _list.retainAll(c);
112     }
113 
114     public E set(int index, E element) {
115         return _list.set(index, element);
116     }
117 
118     public int size() {
119         return _list.size();
120     }
121 
122     public List<E> subList(int fromIndex, int toIndex) {
123         return _list.subList(fromIndex, toIndex);
124     }
125 
126     public Object[] toArray() {
127         return _list.toArray();
128     }
129 
130     public <T> T[] toArray(T[] a) {
131         return _list.toArray(a);
132     }
133 
134     private List<E> _list;
135 
136 }