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 import java.util.List;
21
22 import org.apache.commons.collections.primitives.FloatCollection;
23 import org.apache.commons.collections.primitives.FloatIterator;
24 import org.apache.commons.collections.primitives.FloatList;
25 import org.apache.commons.collections.primitives.FloatListIterator;
26
27
28
29
30
31
32
33 abstract class AbstractListFloatList extends AbstractCollectionFloatCollection implements FloatList {
34
35 public void add(int index, float element) {
36 getList().add(index,new Float(element));
37 }
38
39 public boolean addAll(int index, FloatCollection collection) {
40 return getList().addAll(index,FloatCollectionCollection.wrap(collection));
41 }
42
43 public float get(int index) {
44 return ((Number)getList().get(index)).floatValue();
45 }
46
47 public int indexOf(float element) {
48 return getList().indexOf(new Float(element));
49 }
50
51 public int lastIndexOf(float element) {
52 return getList().lastIndexOf(new Float(element));
53 }
54
55
56
57
58
59
60
61
62 public FloatListIterator listIterator() {
63 return ListIteratorFloatListIterator.wrap(getList().listIterator());
64 }
65
66
67
68
69
70
71
72
73 public FloatListIterator listIterator(int index) {
74 return ListIteratorFloatListIterator.wrap(getList().listIterator(index));
75 }
76
77 public float removeElementAt(int index) {
78 return ((Number)getList().remove(index)).floatValue();
79 }
80
81 public float set(int index, float element) {
82 return ((Number)getList().set(index,new Float(element))).floatValue();
83 }
84
85 public FloatList subList(int fromIndex, int toIndex) {
86 return ListFloatList.wrap(getList().subList(fromIndex,toIndex));
87 }
88
89 public boolean equals(Object obj) {
90 if(obj instanceof FloatList) {
91 FloatList that = (FloatList)obj;
92 if(this == that) {
93 return true;
94 } else if(this.size() != that.size()) {
95 return false;
96 } else {
97 FloatIterator thisiter = iterator();
98 FloatIterator thatiter = that.iterator();
99 while(thisiter.hasNext()) {
100 if(thisiter.next() != thatiter.next()) {
101 return false;
102 }
103 }
104 return true;
105 }
106 } else {
107 return false;
108 }
109 }
110
111 public int hashCode() {
112 return getList().hashCode();
113 }
114
115 final protected Collection getCollection() {
116 return getList();
117 }
118
119 abstract protected List getList();
120 }