KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > collections > primitives > adapters > Adapt


1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.commons.collections.primitives.adapters;
18
19 import java.util.Collection JavaDoc;
20 import java.util.Iterator JavaDoc;
21 import java.util.List JavaDoc;
22 import java.util.ListIterator JavaDoc;
23
24 import org.apache.commons.collections.primitives.ByteCollection;
25 import org.apache.commons.collections.primitives.ByteIterator;
26 import org.apache.commons.collections.primitives.ByteList;
27 import org.apache.commons.collections.primitives.ByteListIterator;
28 import org.apache.commons.collections.primitives.CharCollection;
29 import org.apache.commons.collections.primitives.CharIterator;
30 import org.apache.commons.collections.primitives.CharList;
31 import org.apache.commons.collections.primitives.CharListIterator;
32 import org.apache.commons.collections.primitives.DoubleCollection;
33 import org.apache.commons.collections.primitives.DoubleIterator;
34 import org.apache.commons.collections.primitives.DoubleList;
35 import org.apache.commons.collections.primitives.DoubleListIterator;
36 import org.apache.commons.collections.primitives.FloatCollection;
37 import org.apache.commons.collections.primitives.FloatIterator;
38 import org.apache.commons.collections.primitives.FloatList;
39 import org.apache.commons.collections.primitives.FloatListIterator;
40 import org.apache.commons.collections.primitives.IntCollection;
41 import org.apache.commons.collections.primitives.IntIterator;
42 import org.apache.commons.collections.primitives.IntList;
43 import org.apache.commons.collections.primitives.IntListIterator;
44 import org.apache.commons.collections.primitives.LongCollection;
45 import org.apache.commons.collections.primitives.LongIterator;
46 import org.apache.commons.collections.primitives.LongList;
47 import org.apache.commons.collections.primitives.LongListIterator;
48 import org.apache.commons.collections.primitives.ShortCollection;
49 import org.apache.commons.collections.primitives.ShortIterator;
50 import org.apache.commons.collections.primitives.ShortList;
51 import org.apache.commons.collections.primitives.ShortListIterator;
52
53 /**
54  * Convenience methods for constructing adapters.
55  *
56  * @since Commons Primitives 1.1
57  * @version $Revision: 480462 $ $Date: 2006-11-29 00:15:00 -0800 (Wed, 29 Nov 2006) $
58  * @author Rodney Waldhoff
59  */

60 public final class Adapt {
61     public Adapt() {
62     }
63     
64     // to object based
65
//---------------------------------------------------------------
66

67     public static final Collection JavaDoc toCollection(ByteCollection c) {
68         return ByteCollectionCollection.wrap(c);
69     }
70     
71     public static final Collection JavaDoc toCollection(CharCollection c) {
72         return CharCollectionCollection.wrap(c);
73     }
74     
75     public static final Collection JavaDoc toCollection(DoubleCollection c) {
76         return DoubleCollectionCollection.wrap(c);
77     }
78     
79     public static final Collection JavaDoc toCollection(FloatCollection c) {
80         return FloatCollectionCollection.wrap(c);
81     }
82     
83     public static final Collection JavaDoc toCollection(IntCollection c) {
84         return IntCollectionCollection.wrap(c);
85     }
86     
87     public static final Collection JavaDoc toCollection(LongCollection c) {
88         return LongCollectionCollection.wrap(c);
89     }
90     
91     public static final Collection JavaDoc toCollection(ShortCollection c) {
92         return ShortCollectionCollection.wrap(c);
93     }
94
95     public static final List JavaDoc toList(ByteList c) {
96         return ByteListList.wrap(c);
97     }
98     
99     public static final List JavaDoc toList(CharList c) {
100         return CharListList.wrap(c);
101     }
102     
103     public static final List JavaDoc toList(DoubleList c) {
104         return DoubleListList.wrap(c);
105     }
106     
107     public static final List JavaDoc toList(FloatList c) {
108         return FloatListList.wrap(c);
109     }
110     
111     public static final List JavaDoc toList(IntList c) {
112         return IntListList.wrap(c);
113     }
114     
115     public static final List JavaDoc toList(LongList c) {
116         return LongListList.wrap(c);
117     }
118     
119     public static final List JavaDoc toList(ShortList c) {
120         return ShortListList.wrap(c);
121     }
122
123     public static final Iterator JavaDoc toIterator(ByteIterator c) {
124         return ByteIteratorIterator.wrap(c);
125     }
126     
127     public static final Iterator JavaDoc toIterator(CharIterator c) {
128         return CharIteratorIterator.wrap(c);
129     }
130     
131     public static final Iterator JavaDoc toIterator(DoubleIterator c) {
132         return DoubleIteratorIterator.wrap(c);
133     }
134     
135     public static final Iterator JavaDoc toIterator(FloatIterator c) {
136         return FloatIteratorIterator.wrap(c);
137     }
138     
139     public static final Iterator JavaDoc toIterator(IntIterator c) {
140         return IntIteratorIterator.wrap(c);
141     }
142     
143     public static final Iterator JavaDoc toIterator(LongIterator c) {
144         return LongIteratorIterator.wrap(c);
145     }
146     
147     public static final Iterator JavaDoc toIterator(ShortIterator c) {
148         return ShortIteratorIterator.wrap(c);
149     }
150
151     public static final ListIterator JavaDoc toListIterator(ByteListIterator c) {
152         return ByteListIteratorListIterator.wrap(c);
153     }
154     
155     public static final ListIterator JavaDoc toListIterator(CharListIterator c) {
156         return CharListIteratorListIterator.wrap(c);
157     }
158     
159     public static final ListIterator JavaDoc toListIterator(DoubleListIterator c) {
160         return DoubleListIteratorListIterator.wrap(c);
161     }
162     
163     public static final ListIterator JavaDoc toListIterator(FloatListIterator c) {
164         return FloatListIteratorListIterator.wrap(c);
165     }
166     
167     public static final ListIterator JavaDoc toListIterator(IntListIterator c) {
168         return IntListIteratorListIterator.wrap(c);
169     }
170     
171     public static final ListIterator JavaDoc toListIterator(LongListIterator c) {
172         return LongListIteratorListIterator.wrap(c);
173     }
174     
175     public static final ListIterator JavaDoc toListIterator(ShortListIterator c) {
176         return ShortListIteratorListIterator.wrap(c);
177     }
178
179     // to byte based
180
//---------------------------------------------------------------
181

182     public static final ByteCollection toByteCollection(Collection JavaDoc c) {
183         return CollectionByteCollection.wrap(c);
184     }
185
186     public static final ByteList toByteList(List JavaDoc c) {
187         return ListByteList.wrap(c);
188     }
189
190     public static final ByteIterator toByteIterator(Iterator JavaDoc c) {
191         return IteratorByteIterator.wrap(c);
192     }
193
194     public static final ByteListIterator toByteListIterator(ListIterator JavaDoc c) {
195         return ListIteratorByteListIterator.wrap(c);
196     }
197
198     // to char based
199
//---------------------------------------------------------------
200

201     public static final CharCollection toCharCollection(Collection JavaDoc c) {
202         return CollectionCharCollection.wrap(c);
203     }
204
205     public static final CharList toCharList(List JavaDoc c) {
206         return ListCharList.wrap(c);
207     }
208
209     public static final CharIterator toCharIterator(Iterator JavaDoc c) {
210         return IteratorCharIterator.wrap(c);
211     }
212
213     public static final CharListIterator toCharListIterator(ListIterator JavaDoc c) {
214         return ListIteratorCharListIterator.wrap(c);
215     }
216
217     // to double based
218
//---------------------------------------------------------------
219

220     public static final DoubleCollection toDoubleCollection(Collection JavaDoc c) {
221         return CollectionDoubleCollection.wrap(c);
222     }
223
224     public static final DoubleList toDoubleList(List JavaDoc c) {
225         return ListDoubleList.wrap(c);
226     }
227
228     public static final DoubleIterator toDoubleIterator(Iterator JavaDoc c) {
229         return IteratorDoubleIterator.wrap(c);
230     }
231
232     public static final DoubleListIterator toDoubleListIterator(ListIterator JavaDoc c) {
233         return ListIteratorDoubleListIterator.wrap(c);
234     }
235     
236     // to float based
237
//---------------------------------------------------------------
238

239     public static final FloatCollection toFloatCollection(Collection JavaDoc c) {
240         return CollectionFloatCollection.wrap(c);
241     }
242
243     public static final FloatList toFloatList(List JavaDoc c) {
244         return ListFloatList.wrap(c);
245     }
246
247     public static final FloatIterator toFloatIterator(Iterator JavaDoc c) {
248         return IteratorFloatIterator.wrap(c);
249     }
250
251     public static final FloatListIterator toFloatListIterator(ListIterator JavaDoc c) {
252         return ListIteratorFloatListIterator.wrap(c);
253     }
254     
255     // to int based
256
//---------------------------------------------------------------
257

258     public static final IntCollection toIntCollection(Collection JavaDoc c) {
259         return CollectionIntCollection.wrap(c);
260     }
261
262     public static final IntList toIntList(List JavaDoc c) {
263         return ListIntList.wrap(c);
264     }
265
266     public static final IntIterator toIntIterator(Iterator JavaDoc c) {
267         return IteratorIntIterator.wrap(c);
268     }
269
270     public static final IntListIterator toIntListIterator(ListIterator JavaDoc c) {
271         return ListIteratorIntListIterator.wrap(c);
272     }
273     
274     // to long based
275
//---------------------------------------------------------------
276

277     public static final LongCollection toLongCollection(Collection JavaDoc c) {
278         return CollectionLongCollection.wrap(c);
279     }
280
281     public static final LongList toLongList(List JavaDoc c) {
282         return ListLongList.wrap(c);
283     }
284
285     public static final LongIterator toLongIterator(Iterator JavaDoc c) {
286         return IteratorLongIterator.wrap(c);
287     }
288
289     public static final LongListIterator toLongListIterator(ListIterator JavaDoc c) {
290         return ListIteratorLongListIterator.wrap(c);
291     }
292     
293     // to short based
294
//---------------------------------------------------------------
295

296     public static final ShortCollection toShortCollection(Collection JavaDoc c) {
297         return CollectionShortCollection.wrap(c);
298     }
299
300     public static final ShortList toShortList(List JavaDoc c) {
301         return ListShortList.wrap(c);
302     }
303
304     public static final ShortIterator toShortIterator(Iterator JavaDoc c) {
305         return IteratorShortIterator.wrap(c);
306     }
307
308     public static final ShortListIterator toShortListIterator(ListIterator JavaDoc c) {
309         return ListIteratorShortListIterator.wrap(c);
310     }
311 }
Popular Tags