1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.collections.primitives.adapters;
18
19 import java.util.Collection;
20
21 import org.apache.commons.collections.primitives.FloatCollection;
22 import org.apache.commons.collections.primitives.FloatIterator;
23
24
25
26
27
28
29 abstract class AbstractCollectionFloatCollection implements FloatCollection {
30 protected AbstractCollectionFloatCollection() {
31 }
32
33 public boolean add(float element) {
34 return getCollection().add(new Float(element));
35 }
36
37 public boolean addAll(FloatCollection c) {
38 return getCollection().addAll(FloatCollectionCollection.wrap(c));
39 }
40
41 public void clear() {
42 getCollection().clear();
43 }
44
45 public boolean contains(float element) {
46 return getCollection().contains(new Float(element));
47 }
48
49 public boolean containsAll(FloatCollection c) {
50 return getCollection().containsAll(FloatCollectionCollection.wrap(c));
51 }
52
53 public String toString() {
54 return getCollection().toString();
55 }
56
57 public boolean isEmpty() {
58 return getCollection().isEmpty();
59 }
60
61
62
63
64
65
66
67
68 public FloatIterator iterator() {
69 return IteratorFloatIterator.wrap(getCollection().iterator());
70 }
71
72 public boolean removeElement(float element) {
73 return getCollection().remove(new Float(element));
74 }
75
76 public boolean removeAll(FloatCollection c) {
77 return getCollection().removeAll(FloatCollectionCollection.wrap(c));
78 }
79
80 public boolean retainAll(FloatCollection c) {
81 return getCollection().retainAll(FloatCollectionCollection.wrap(c));
82 }
83
84 public int size() {
85 return getCollection().size();
86 }
87
88 public float[] toArray() {
89 Object[] src = getCollection().toArray();
90 float[] dest = new float[src.length];
91 for(int i=0;i<src.length;i++) {
92 dest[i] = ((Number)(src[i])).floatValue();
93 }
94 return dest;
95 }
96
97 public float[] toArray(float[] dest) {
98 Object[] src = getCollection().toArray();
99 if(dest.length < src.length) {
100 dest = new float[src.length];
101 }
102 for(int i=0;i<src.length;i++) {
103 dest[i] = ((Number)(src[i])).floatValue();
104 }
105 return dest;
106 }
107
108 protected abstract Collection getCollection();
109
110 }