1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.ibatis.submitted.custom_collection_handling;
17
18 import java.util.*;
19
20 public class CustomCollection<T> {
21
22 private List<T> data = new ArrayList<T>();
23
24 public <K> K[] toArray(K[] a) {
25 return data.toArray(a);
26 }
27
28 public Object[] toArray() {
29 return data.toArray();
30 }
31
32 public List<T> subList(int fromIndex, int toIndex) {
33 return data.subList(fromIndex, toIndex);
34 }
35
36 public int size() {
37 return data.size();
38 }
39
40 public T set(int index, T element) {
41 return data.set(index, element);
42 }
43
44 public boolean retainAll(Collection<?> c) {
45 return data.retainAll(c);
46 }
47
48 public boolean removeAll(Collection<?> c) {
49 return data.removeAll(c);
50 }
51
52 public T remove(int index) {
53 return data.remove(index);
54 }
55
56 public boolean remove(Object o) {
57 return data.remove(o);
58 }
59
60 public ListIterator<T> listIterator(int index) {
61 return data.listIterator(index);
62 }
63
64 public ListIterator<T> listIterator() {
65 return data.listIterator();
66 }
67
68 public int lastIndexOf(Object o) {
69 return data.lastIndexOf(o);
70 }
71
72 public Iterator<T> iterator() {
73 return data.iterator();
74 }
75
76 public boolean isEmpty() {
77 return data.isEmpty();
78 }
79
80 public int indexOf(Object o) {
81 return data.indexOf(o);
82 }
83
84 @Override
85 public int hashCode() {
86 return data.hashCode();
87 }
88
89 public T get(int index) {
90 return data.get(index);
91 }
92
93 @Override
94 public boolean equals(Object o) {
95 if (!(o instanceof CustomCollection)) return false;
96 return data.equals(((CustomCollection)o).data);
97 }
98
99 public boolean containsAll(Collection<?> c) {
100 return data.containsAll(c);
101 }
102
103 public boolean contains(Object o) {
104 return data.contains(o);
105 }
106
107 public void clear() {
108 data.clear();
109 }
110
111 public boolean addAll(int index, Collection<? extends T> c) {
112 return data.addAll(index, c);
113 }
114
115 public boolean addAll(Collection<? extends T> c) {
116 return data.addAll(c);
117 }
118
119 public void add(int index, T element) {
120 data.add(index, element);
121 }
122
123 public boolean add(T e) {
124 return data.add(e);
125 }
126
127 }