You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: core/queryalgebra/evaluation/src/main/java/org/eclipse/rdf4j/query/algebra/evaluation/ArrayBindingSet.java
+22-15Lines changed: 22 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -185,6 +185,10 @@ private int getIndex(String bindingName) {
185
185
186
186
@Override
187
187
publicSet<String> getBindingNames() {
188
+
if (isEmpty()) {
189
+
returnCollections.emptySet();
190
+
}
191
+
188
192
if (bindingNamesSetCache == null) {
189
193
intsize = size();
190
194
if (size == 0) {
@@ -213,6 +217,10 @@ public Set<String> getBindingNames() {
213
217
214
218
@Override
215
219
publicValuegetValue(StringbindingName) {
220
+
if (isEmpty()) {
221
+
returnnull;
222
+
}
223
+
216
224
for (inti = 0; i < bindingNames.length; i++) {
217
225
if (bindingNames[i] == bindingName && whichBindingsHaveBeenSet[i]) {
218
226
returnvalues[i];
@@ -229,6 +237,10 @@ public Value getValue(String bindingName) {
229
237
230
238
@Override
231
239
publicBindinggetBinding(StringbindingName) {
240
+
if (isEmpty()) {
241
+
returnnull;
242
+
}
243
+
232
244
Valuevalue = getValue(bindingName);
233
245
234
246
if (value != null) {
@@ -240,6 +252,10 @@ public Binding getBinding(String bindingName) {
240
252
241
253
@Override
242
254
publicbooleanhasBinding(StringbindingName) {
255
+
if (isEmpty()) {
256
+
returnfalse;
257
+
}
258
+
243
259
intindex = getIndex(bindingName);
244
260
if (index == -1) {
245
261
returnfalse;
@@ -249,6 +265,10 @@ public boolean hasBinding(String bindingName) {
249
265
250
266
@Override
251
267
publicIterator<Binding> iterator() {
268
+
if (isEmpty()) {
269
+
returnCollections.emptyIterator();
270
+
}
271
+
252
272
returnnewArrayBindingSetIterator();
253
273
}
254
274
@@ -257,6 +277,7 @@ public int size() {
257
277
if (isEmpty()) {
258
278
return0;
259
279
}
280
+
260
281
intsize = 0;
261
282
262
283
for (booleanvalue : whichBindingsHaveBeenSet) {
@@ -271,6 +292,7 @@ public int size() {
271
292
List<String> sortedBindingNames = null;
272
293
273
294
publicList<String> getSortedBindingNames() {
295
+
274
296
if (sortedBindingNames == null) {
275
297
intsize = size();
276
298
@@ -350,21 +372,6 @@ public void setBinding(String name, Value value) {
0 commit comments