< prev index next >

src/hotspot/share/utilities/growableArray.hpp

Print this page

124   ~GrowableArrayView() {}
125 
126 public:
127   const static GrowableArrayView EMPTY;
128 
129   bool operator==(const GrowableArrayView<E>& rhs) const {
130     if (_len != rhs._len)
131       return false;
132     for (int i = 0; i < _len; i++) {
133       if (at(i) != rhs.at(i)) {
134         return false;
135       }
136     }
137     return true;
138   }
139 
140   bool operator!=(const GrowableArrayView<E>& rhs) const {
141     return !(*this == rhs);
142   }
143 








144   E& at(int i) {
145     assert(0 <= i && i < _len, "illegal index");
146     return _data[i];
147   }
148 
149   E const& at(int i) const {
150     assert(0 <= i && i < _len, "illegal index");
151     return _data[i];
152   }
153 
154   E* adr_at(int i) const {
155     assert(0 <= i && i < _len, "illegal index");
156     return &_data[i];
157   }
158 
159   E first() const {
160     assert(_len > 0, "empty list");
161     return _data[0];
162   }
163 

124   ~GrowableArrayView() {}
125 
126 public:
127   const static GrowableArrayView EMPTY;
128 
129   bool operator==(const GrowableArrayView<E>& rhs) const {
130     if (_len != rhs._len)
131       return false;
132     for (int i = 0; i < _len; i++) {
133       if (at(i) != rhs.at(i)) {
134         return false;
135       }
136     }
137     return true;
138   }
139 
140   bool operator!=(const GrowableArrayView<E>& rhs) const {
141     return !(*this == rhs);
142   }
143 
144   E* data() {
145     return _data;
146   }
147 
148   const E* data() const {
149     return _data;
150   }
151 
152   E& at(int i) {
153     assert(0 <= i && i < _len, "illegal index");
154     return _data[i];
155   }
156 
157   E const& at(int i) const {
158     assert(0 <= i && i < _len, "illegal index");
159     return _data[i];
160   }
161 
162   E* adr_at(int i) const {
163     assert(0 <= i && i < _len, "illegal index");
164     return &_data[i];
165   }
166 
167   E first() const {
168     assert(_len > 0, "empty list");
169     return _data[0];
170   }
171 
< prev index next >