comparison truffle/com.oracle.truffle.api.interop/src/com/oracle/truffle/api/interop/impl/ReadOnlyArrayList.java @ 22505:c81e7280af42

add @TruffleBoundary to ReadOnlyArrayList#toString
author Andreas Woess <andreas.woess@oracle.com>
date Thu, 17 Dec 2015 15:11:22 +0100
parents fbe1eb7b4172
children
comparison
equal deleted inserted replaced
22504:d80a5ff56f51 22505:c81e7280af42
28 import java.util.Collection; 28 import java.util.Collection;
29 import java.util.Iterator; 29 import java.util.Iterator;
30 import java.util.List; 30 import java.util.List;
31 import java.util.ListIterator; 31 import java.util.ListIterator;
32 import java.util.NoSuchElementException; 32 import java.util.NoSuchElementException;
33
34 import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
33 35
34 public final class ReadOnlyArrayList<T> implements List<T> { 36 public final class ReadOnlyArrayList<T> implements List<T> {
35 private final T[] arr; 37 private final T[] arr;
36 private final int first; 38 private final int first;
37 private final int last; 39 private final int last;
209 @Override 211 @Override
210 public List<T> subList(int fromIndex, int toIndex) { 212 public List<T> subList(int fromIndex, int toIndex) {
211 return new ReadOnlyArrayList<>(arr, first + fromIndex, first + toIndex); 213 return new ReadOnlyArrayList<>(arr, first + fromIndex, first + toIndex);
212 } 214 }
213 215
216 @TruffleBoundary
214 @Override 217 @Override
215 public String toString() { 218 public String toString() {
216 Iterator<T> it = iterator(); 219 Iterator<T> it = iterator();
217 if (!it.hasNext()) { 220 if (!it.hasNext()) {
218 return "[]"; 221 return "[]";