1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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  public class ListWrapper<E> implements List<E> {
36  
37      public ListWrapper(List<E> list) {
38          _list = list;
39      }
40  
41      public boolean add(E o) {
42          return _list.add(o);
43      }
44  
45      public void add(int index, E element) {
46          _list.add(index, element);
47      }
48  
49      public boolean addAll(Collection<? extends E> c) {
50          return _list.addAll(c);
51      }
52  
53      public boolean addAll(int index, Collection<? extends E> c) {
54          return _list.addAll(index, c);
55      }
56  
57      public void clear() {
58          _list.clear();
59      }
60  
61      public boolean contains(Object o) {
62          return _list.contains(o);
63      }
64  
65      public boolean containsAll(Collection<?> c) {
66          return _list.containsAll(c);
67      }
68  
69      public E get(int index) {
70          return _list.get(index);
71      }
72  
73      public int indexOf(Object o) {
74          return _list.indexOf(o);
75      }
76  
77      public boolean isEmpty() {
78          return _list.isEmpty();
79      }
80  
81      public Iterator<E> iterator() {
82          return _list.iterator();
83      }
84  
85      public int lastIndexOf(Object o) {
86          return _list.lastIndexOf(o);
87      }
88  
89      public ListIterator<E> listIterator() {
90          return _list.listIterator();
91      }
92  
93      public ListIterator<E> listIterator(int index) {
94          return _list.listIterator(index);
95      }
96  
97      public boolean remove(Object o) {
98          return _list.remove(o);
99      }
100 
101     public E remove(int index) {
102         return _list.remove(index);
103     }
104 
105     public boolean removeAll(Collection<?> c) {
106         return _list.removeAll(c);
107     }
108 
109     public boolean retainAll(Collection<?> c) {
110         return _list.retainAll(c);
111     }
112 
113     public E set(int index, E element) {
114         return _list.set(index, element);
115     }
116 
117     public int size() {
118         return _list.size();
119     }
120 
121     public List<E> subList(int fromIndex, int toIndex) {
122         return _list.subList(fromIndex, toIndex);
123     }
124 
125     public Object[] toArray() {
126         return _list.toArray();
127     }
128 
129     public <T> T[] toArray(T[] a) {
130         return _list.toArray(a);
131     }
132 
133     private List<E> _list;
134 
135 }