001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.util;
016    
017    import java.util.Collection;
018    import java.util.Iterator;
019    import java.util.List;
020    import java.util.ListIterator;
021    
022    /**
023     * @author Brian Wing Shun Chan
024     */
025    public class ListWrapper<E> implements List<E> {
026    
027            public ListWrapper(List<E> list) {
028                    _list = list;
029            }
030    
031            public boolean add(E o) {
032                    return _list.add(o);
033            }
034    
035            public void add(int index, E element) {
036                    _list.add(index, element);
037            }
038    
039            public boolean addAll(Collection<? extends E> c) {
040                    return _list.addAll(c);
041            }
042    
043            public boolean addAll(int index, Collection<? extends E> c) {
044                    return _list.addAll(index, c);
045            }
046    
047            public void clear() {
048                    _list.clear();
049            }
050    
051            public boolean contains(Object o) {
052                    return _list.contains(o);
053            }
054    
055            public boolean containsAll(Collection<?> c) {
056                    return _list.containsAll(c);
057            }
058    
059            public E get(int index) {
060                    return _list.get(index);
061            }
062    
063            public int indexOf(Object o) {
064                    return _list.indexOf(o);
065            }
066    
067            public boolean isEmpty() {
068                    return _list.isEmpty();
069            }
070    
071            public Iterator<E> iterator() {
072                    return _list.iterator();
073            }
074    
075            public int lastIndexOf(Object o) {
076                    return _list.lastIndexOf(o);
077            }
078    
079            public ListIterator<E> listIterator() {
080                    return _list.listIterator();
081            }
082    
083            public ListIterator<E> listIterator(int index) {
084                    return _list.listIterator(index);
085            }
086    
087            public boolean remove(Object o) {
088                    return _list.remove(o);
089            }
090    
091            public E remove(int index) {
092                    return _list.remove(index);
093            }
094    
095            public boolean removeAll(Collection<?> c) {
096                    return _list.removeAll(c);
097            }
098    
099            public boolean retainAll(Collection<?> c) {
100                    return _list.retainAll(c);
101            }
102    
103            public E set(int index, E element) {
104                    return _list.set(index, element);
105            }
106    
107            public int size() {
108                    return _list.size();
109            }
110    
111            public List<E> subList(int fromIndex, int toIndex) {
112                    return _list.subList(fromIndex, toIndex);
113            }
114    
115            public Object[] toArray() {
116                    return _list.toArray();
117            }
118    
119            public <T> T[] toArray(T[] a) {
120                    return _list.toArray(a);
121            }
122    
123            private List<E> _list;
124    
125    }