1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.kernel.util;
21  
22  import java.util.Collection;
23  import java.util.Iterator;
24  import java.util.List;
25  import java.util.ListIterator;
26  
27  /**
28   * <a href="ListWrapper.java.html"><b><i>View Source</i></b></a>
29   *
30   * @author Brian Wing Shun Chan
31   *
32   */
33  public class ListWrapper<E> implements List<E> {
34  
35      public ListWrapper(List<E> list) {
36          _list = list;
37      }
38  
39      public boolean add(E o) {
40          return _list.add(o);
41      }
42  
43      public void add(int index, E element) {
44          _list.add(index, element);
45      }
46  
47      public boolean addAll(Collection<? extends E> c) {
48          return _list.addAll(c);
49      }
50  
51      public boolean addAll(int index, Collection<? extends E> c) {
52          return _list.addAll(index, c);
53      }
54  
55      public void clear() {
56          _list.clear();
57      }
58  
59      public boolean contains(Object o) {
60          return _list.contains(o);
61      }
62  
63      public boolean containsAll(Collection<?> c) {
64          return _list.containsAll(c);
65      }
66  
67      public E get(int index) {
68          return _list.get(index);
69      }
70  
71      public int indexOf(Object o) {
72          return _list.indexOf(o);
73      }
74  
75      public boolean isEmpty() {
76          return _list.isEmpty();
77      }
78  
79      public Iterator<E> iterator() {
80          return _list.iterator();
81      }
82  
83      public int lastIndexOf(Object o) {
84          return _list.lastIndexOf(o);
85      }
86  
87      public ListIterator<E> listIterator() {
88          return _list.listIterator();
89      }
90  
91      public ListIterator<E> listIterator(int index) {
92          return _list.listIterator(index);
93      }
94  
95      public boolean remove(Object o) {
96          return _list.remove(o);
97      }
98  
99      public E remove(int index) {
100         return _list.remove(index);
101     }
102 
103     public boolean removeAll(Collection<?> c) {
104         return _list.removeAll(c);
105     }
106 
107     public boolean retainAll(Collection<?> c) {
108         return _list.retainAll(c);
109     }
110 
111     public E set(int index, E element) {
112         return _list.set(index, element);
113     }
114 
115     public int size() {
116         return _list.size();
117     }
118 
119     public List<E> subList(int fromIndex, int toIndex) {
120         return _list.subList(fromIndex, toIndex);
121     }
122 
123     public Object[] toArray() {
124         return _list.toArray();
125     }
126 
127     public <T> T[] toArray(T[] a) {
128         return _list.toArray(a);
129     }
130 
131     private List<E> _list;
132 
133 }