/** * Returns a fixed-sized list backed by the given list. * Elements may not be added or removed from the returned list, but * existing elements can be changed (for instance, via the * {@link List#set(int,Object)} method). * * @param list the list whose size to fix, must not be null * @return a fixed-size list backed by that list * @throws IllegalArgumentException if the List is null */ public static List fixedSizeList(List list) { return FixedSizeList.decorate(list); }
public List subList(int fromIndex, int toIndex) { List sub = getList().subList(fromIndex, toIndex); return new FixedSizeList(sub); }
public Iterator iterator() { return UnmodifiableIterator.decorate(getCollection().iterator()); }
public Object set(int index, Object object) { return getList().set(index, object); }
/** * Factory method to create a fixed size list. * * @param list the list to decorate, must not be null * @throws IllegalArgumentException if list is null */ public static List decorate(List list) { return new FixedSizeList(list); }
public int maxSize() { return size(); }
public Object get(int index) { return getList().get(index); }
/** * Factory method to create a fixed size list. * * @param list the list to decorate, must not be null * @throws IllegalArgumentException if list is null */ public static List decorate(List list) { return new FixedSizeList(list); }
public int maxSize() { return size(); }
public int indexOf(Object object) { return getList().indexOf(object); }
public List subList(int fromIndex, int toIndex) { List sub = getList().subList(fromIndex, toIndex); return new FixedSizeList(sub); }
/** * Returns a fixed-sized list backed by the given list. * Elements may not be added or removed from the returned list, but * existing elements can be changed (for instance, via the * {@link List#set(int,Object)} method). * * @param list the list whose size to fix, must not be null * @return a fixed-size list backed by that list * @throws IllegalArgumentException if the List is null */ public static List fixedSizeList(List list) { return FixedSizeList.decorate(list); }
/** * Factory method to create a fixed size list. * * @param list the list to decorate, must not be null * @throws IllegalArgumentException if list is null */ public static List decorate(List list) { return new FixedSizeList(list); }
public int maxSize() { return size(); }
public Iterator iterator() { return UnmodifiableIterator.decorate(getCollection().iterator()); }
public int lastIndexOf(Object object) { return getList().lastIndexOf(object); }
public List subList(int fromIndex, int toIndex) { List sub = getList().subList(fromIndex, toIndex); return new FixedSizeList(sub); }
public List makeEmptyList() { return FixedSizeList.decorate(new ArrayList()); }
/** * Factory method to create a fixed size list. * * @param list the list to decorate, must not be null * @throws IllegalArgumentException if list is null */ public static List decorate(List list) { return new FixedSizeList(list); }
public int maxSize() { return size(); }