You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2003/09/08 01:52:10 UTC

cvs commit: jakarta-commons-sandbox/primitives/src/java/org/apache/commons/primitive/list PrimitiveList.java IntList.java

scolebourne    2003/09/07 16:52:10

  Modified:    primitives/src/java/org/apache/commons/primitive/collection
                        IntCollection.java
               primitives/src/java/org/apache/commons/primitive/iterator
                        IntIterator.java PrimitiveIterator.java
  Added:       primitives/src/java/org/apache/commons/primitive/listiterator
                        IntListIterator.java PrimitiveListIterator.java
               primitives/src/java/org/apache/commons/primitive/list
                        PrimitiveList.java IntList.java
  Log:
  Add more detail to proposed interfaces
  
  Revision  Changes    Path
  1.2       +35 -3     jakarta-commons-sandbox/primitives/src/java/org/apache/commons/primitive/collection/IntCollection.java
  
  Index: IntCollection.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/primitives/src/java/org/apache/commons/primitive/collection/IntCollection.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IntCollection.java	1 Sep 2003 23:56:05 -0000	1.1
  +++ IntCollection.java	7 Sep 2003 23:52:10 -0000	1.2
  @@ -89,6 +89,14 @@
       boolean containsValue(int value);
   
       /**
  +     * Checks if the collection contains all of the primitive values (optional operation).
  +     *
  +     * @param values  the values to search for
  +     * @return <code>true</code> if all the values are found
  +     */
  +    boolean containsAllValues(int[] values);
  +
  +    /**
        * Gets the elements of this collection as an array.
        *
        * @return a new array containing a copy of the elements of this collection
  @@ -105,7 +113,7 @@
        * @param array  the array to add the elements to
        * @param insertionIndex  the position in the array to add the elements to
        * @return the array with the inserted collection
  -     * @throws IndexOutOfBoundsException is the index is invalid
  +     * @throws IndexOutOfBoundsException if the index is invalid
        */
       int[] toValueArray(int[] array, int insertionIndex);
   
  @@ -133,9 +141,33 @@
        *
        * @param value  the value to remove
        * @return <code>true</code> if this collection was modified by this method call
  -     * @throws IllegalArgumentException if value is rejected by this collection
        * @throws UnsupportedOperationException if not supported by this collection
        */
       boolean removeValue(int value);
  +
  +    /**
  +     * Adds an array of primitive values to this list (optional operation).
  +     * <p>
  +     * This method is optional, throwing an UnsupportedOperationException if the
  +     * collection cannot be added to.
  +     *
  +     * @param values  the values to add to this collection
  +     * @return <code>true</code> if this list was modified by this method call
  +     * @throws IllegalArgumentException if value is rejected by this collection
  +     * @throws UnsupportedOperationException if not supported by this collection
  +     */
  +    boolean addAllValues(int[] values);
  +
  +    /**
  +     * Removes each of an array of primitive values from this list (optional operation).
  +     * <p>
  +     * This method is optional, throwing an UnsupportedOperationException if the
  +     * collection cannot be added to.
  +     *
  +     * @param values  the values to remove from this collection
  +     * @return <code>true</code> if this list was modified by this method call
  +     * @throws UnsupportedOperationException if not supported by this collection
  +     */
  +    boolean removeAllValues(int[] values);
   
   }
  
  
  
  1.2       +2 -2      jakarta-commons-sandbox/primitives/src/java/org/apache/commons/primitive/iterator/IntIterator.java
  
  Index: IntIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/primitives/src/java/org/apache/commons/primitive/iterator/IntIterator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IntIterator.java	1 Sep 2003 23:56:06 -0000	1.1
  +++ IntIterator.java	7 Sep 2003 23:52:10 -0000	1.2
  @@ -70,6 +70,6 @@
        * @return the next available value
        * @throws NoSuchElementException if there are no more values available
        */
  -    int next();
  +    int nextValue();
   
   }
  
  
  
  1.2       +4 -25     jakarta-commons-sandbox/primitives/src/java/org/apache/commons/primitive/iterator/PrimitiveIterator.java
  
  Index: PrimitiveIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/primitives/src/java/org/apache/commons/primitive/iterator/PrimitiveIterator.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PrimitiveIterator.java	1 Sep 2003 23:56:06 -0000	1.1
  +++ PrimitiveIterator.java	7 Sep 2003 23:52:10 -0000	1.2
  @@ -53,6 +53,8 @@
    */
   package org.apache.commons.primitive.iterator;
   
  +import java.util.Iterator;
  +
   /**
    * Base interface for all primitive iterator interfaces.
    * 
  @@ -60,29 +62,6 @@
    * @version $Id$
    * @since 1.0
    */
  -public interface PrimitiveIterator {
  +public interface PrimitiveIterator extends Iterator {
   
  -    // Mandatory operations
  -    //-----------------------------------------------------------------------
  -    /**
  -     * Checks whether the iterator has another value.
  -     * 
  -     * @return <code>true</code> if there is another value available
  -     */
  -    boolean hasNext();
  -    
  -    // Optional operations
  -    //-----------------------------------------------------------------------
  -    /**
  -     * Removes the last retrieved value from the underlying collection (optional operation).
  -     * <p>
  -     * This method is optional, throwing an UnsupportedOperationException if the
  -     * collection cannot be removed from.
  -     * 
  -     * @return <code>true</code> if there is another value available
  -     * @throws IllegalStateException if <code>next</code> has not yet been called
  -     * @throws IllegalStateException if <code>remove</code> has already been called
  -     */
  -    void remove();
  -    
   }
  
  
  
  1.1                  jakarta-commons-sandbox/primitives/src/java/org/apache/commons/primitive/listiterator/IntListIterator.java
  
  Index: IntListIterator.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowledgement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgement may appear in the software itself,
   *    if and wherever such third-party acknowledgements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.primitive.listiterator;
  
  /**
   * Defines a list iterator over primitive <code>int</code> values.
   * 
   * @author Stephen Colebourne
   * @version $Id: IntListIterator.java,v 1.1 2003/09/07 23:52:10 scolebourne Exp $
   * @since 1.0
   */
  public interface IntListIterator extends PrimitiveListIterator {
  
      // Mandatory operations
      //-----------------------------------------------------------------------
      /**
       * Gets the previous value from the iterator.
       *
       * @return the previous available value
       * @throws NoSuchElementException if there are no more values available
       */
      int previousValue();
  
      // Optional operations
      //-----------------------------------------------------------------------
      /**
       * Adds the specified value to the list underlying the iterator at the
       * current iteration index.
       *
       * @param value  the value to add
       * @throws IllegalStateException if the iterator cannot be added to at present
       * @throws UnsupportedOperationException if not supported by this collection
       */
      void addValue(int value);
  
      /**
       * Sets the last retrieved value from the iterator.
       *
       * @param value  the value to set
       * @throws IllegalStateException if the iterator cannot be set to at present
       * @throws UnsupportedOperationException if not supported by this collection
       */
      int setValue(int value);
  
  }
  
  
  
  1.1                  jakarta-commons-sandbox/primitives/src/java/org/apache/commons/primitive/listiterator/PrimitiveListIterator.java
  
  Index: PrimitiveListIterator.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowledgement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgement may appear in the software itself,
   *    if and wherever such third-party acknowledgements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.primitive.listiterator;
  
  import java.util.ListIterator;
  
  import org.apache.commons.primitive.iterator.PrimitiveIterator;
  
  /**
   * Base interface for all primitive list iterator interfaces.
   * 
   * @author Stephen Colebourne
   * @version $Id: PrimitiveListIterator.java,v 1.1 2003/09/07 23:52:10 scolebourne Exp $
   * @since 1.0
   */
  public interface PrimitiveListIterator extends PrimitiveIterator, ListIterator {
  
  }
  
  
  
  1.1                  jakarta-commons-sandbox/primitives/src/java/org/apache/commons/primitive/list/PrimitiveList.java
  
  Index: PrimitiveList.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowledgement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgement may appear in the software itself,
   *    if and wherever such third-party acknowledgements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.primitive.list;
  
  import java.util.List;
  
  import org.apache.commons.primitive.collection.PrimitiveCollection;
  
  /**
   * Base interface for all primitive list interfaces.
   * <p>
   * This interface extends {@link List} allowing seamless integration with other APIs.
   * All List methods can be used, using the primitive wrapper class.
   * However, it will be <em>much</em> more efficient to use the direct primitive methods
   * in the subinterface.
   * 
   * @author Stephen Colebourne
   * @version $Id: PrimitiveList.java,v 1.1 2003/09/07 23:52:10 scolebourne Exp $
   * @since 1.0
   */
  public interface PrimitiveList extends PrimitiveCollection, List {
  
      /**
       * Gets the last index of the specified primitive value.
       *
       * @param fromIndexInclusive  the start of the range to remove, inclusive
       * @param toIndexExclusive  the end of the range to remove, exclusive
       * @return <code>true</code> if the collection was modified
       */
      boolean removeRange(int fromIndexInclusive, int toIndexExclusive);
  
  }
  
  
  
  1.1                  jakarta-commons-sandbox/primitives/src/java/org/apache/commons/primitive/list/IntList.java
  
  Index: IntList.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution, if
   *    any, must include the following acknowledgement:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgement may appear in the software itself,
   *    if and wherever such third-party acknowledgements normally appear.
   *
   * 4. The names "The Jakarta Project", "Commons", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.commons.primitive.list;
  
  import org.apache.commons.primitive.listiterator.IntListIterator;
  
  /**
   * Defines a list of primitive <code>int</code> values.
   * <p>
   * This interface extends {@link List} allowing seamless integration with other APIs.
   * All List methods can be used, using the primitive wrapper class {@link Integer}.
   * However, it will be <em>much</em> more efficient to use the methods defined here.
   * 
   * @author Stephen Colebourne
   * @version $Id: IntList.java,v 1.1 2003/09/07 23:52:10 scolebourne Exp $
   * @since 1.0
   */
  public interface IntList extends PrimitiveList {
  
      // Mandatory operations
      //-----------------------------------------------------------------------
      /**
       * Gets the primitive value at the specified index.
       *
       * @param index  the index to get from
       * @return value at the index
       * @throws IndexOutOfBoundsException if the index is invalid
       */
      int getValue(int index);
  
      /**
       * Gets the first primitive value.
       *
       * @return value at index zero
       * @throws IndexOutOfBoundsException if the index is invalid
       */
      int firstValue();
  
      /**
       * Gets the last primitive value.
       *
       * @return value at index <code>size() - 1</code>
       * @throws IndexOutOfBoundsException if the index is invalid
       */
      int lastValue();
  
      /**
       * Gets a list iterator over this list.
       *
       * @return an iterator over this list
       */
      IntListIterator valueListIterator();
  
      /**
       * Gets a list iterator over this list from a start index.
       *
       * @param index  the index to start from
       * @return an iterator over this list
       * @throws IndexOutOfBoundsException if the index is invalid
       */
      IntListIterator valueListIterator(int index);
  
      /**
       * Gets the first index of the specified primitive value.
       *
       * @param value  the value to search for
       * @return the zero-based index, or <code>-1</code> if not found
       */
      int indexOfValue(int value);
  
      /**
       * Gets the first index of the specified primitive value from an index.
       * <p>
       * This method follows the conventions of <code>String</code> in that a
       * negative index is treated as zero, and an index greater than the list
       * size will simply return <code>-1</code>.
       *
       * @param value  the value to search for
       * @param fromIndexInclusive  the index to start searching from, inclusive
       * @return the zero-based index, or <code>-1</code> if not found
       */
      int indexOfValue(int value, int fromIndexInclusive);
  
      /**
       * Gets the last index of the specified primitive value.
       *
       * @param value  the value to search for
       * @return the zero-based index, or <code>-1</code> if not found
       */
      int lastIndexOfValue(int value);
  
      /**
       * Gets the first index of the specified primitive value from an index.
       * <p>
       * This method follows the conventions of <code>String</code> in that an
       * index greater than the list size will start searching at the list size,
       * and a negative index simply returns <code>-1</code>.
       *
       * @param value  the value to search for
       * @param fromIndexInclusive  the index to start searching from, inclusive
       * @return the zero-based index, or <code>-1</code> if not found
       */
      int lastIndexOfValue(int value, int fromIndexInclusive);
  
      /**
       * Gets a range of elements as an array.
       *
       * @param fromIndexInclusive  the index to start from, inclusive
       * @param toIndexExclusive  the index to end at, exclusive
       * @return a new array containing a copy of the range of elements
       * @throws IndexOutOfBoundsException if either index is invalid
       */
      int[] toValueArray(int fromIndexInclusive, int toIndexExclusive);
  
      /**
       * Copies a range of elements into an array at a specified position.
       * <p>
       * If the array specified is large enough, it will be modified.
       * If the array is not large enough, a new array will be created and all
       * elements copied before the insertion begins.
       *
       * @param fromIndexInclusive  the index to start from, inclusive
       * @param toIndexExclusive  the index to end at, exclusive
       * @param array  the array to add the elements to
       * @param insertionIndex  the position in the array to add the elements to
       * @return the array with the inserted collection
       * @throws IndexOutOfBoundsException if any index is invalid
       */
      int[] toValueArray(int fromIndexInclusive, int toIndexExclusive, int[] array, int insertionIndex);
  
      /**
       * Sets the primitive values starting at a specified index.
       * <p>
       * This method is optional, throwing an UnsupportedOperationException if the
       * collection cannot be changed.
       *
       * @param fromIndexInclusive  the index to start from, inclusive
       * @param toIndexExclusive  the index to end at, exclusive
       * @return a new IntList for the subList
       * @throws IndexOutOfBoundsException if either index is invalid
       */
      IntList valueSubList(int fromIndexInclusive, int toIndexExclusive);
  
      // Optional operations
      //-----------------------------------------------------------------------
      /**
       * Adds a primitive value to this list at an index (optional operation).
       * <p>
       * This method is optional, throwing an UnsupportedOperationException if the
       * collection cannot be added to.
       *
       * @param index  the index to add at
       * @param value  the value to add to this collection
       * @return <code>true</code> if this list was modified by this method call
       * @throws IndexOutOfBoundsException if the index is invalid
       * @throws IllegalArgumentException if value is rejected by this collection
       * @throws UnsupportedOperationException if not supported by this collection
       */
      boolean addValue(int index, int value);
  
      /**
       * Adds an array of primitive values to this list at an index (optional operation).
       * <p>
       * This method is optional, throwing an UnsupportedOperationException if the
       * collection cannot be added to.
       *
       * @param index  the index to add at
       * @param values  the values to add to this collection
       * @return <code>true</code> if this list was modified by this method call
       * @throws IndexOutOfBoundsException if the index is invalid
       * @throws IllegalArgumentException if value is rejected by this collection
       * @throws UnsupportedOperationException if not supported by this collection
       */
      boolean addAllValues(int index, int[] values);
  
      /**
       * Sets the primitive value at a specified index.
       * <p>
       * This method is optional, throwing an UnsupportedOperationException if the
       * collection cannot be changed.
       *
       * @param index  the index to set
       * @param value  the value to store
       * @return the previous value at the index
       * @throws IndexOutOfBoundsException if the index is invalid
       * @throws IllegalArgumentException if value is rejected by this collection
       * @throws UnsupportedOperationException if not supported by this collection
       */
      int setValue(int index, int value);
  
      /**
       * Sets the primitive values starting at a specified index.
       * <p>
       * This method is optional, throwing an UnsupportedOperationException if the
       * collection cannot be changed.
       *
       * @param index  the index to start setting at
       * @param values  the values to store
       * @return <code>true</code> if this list was modified by this method call
       * @throws IndexOutOfBoundsException if the index is invalid
       * @throws IllegalArgumentException if value is rejected by this collection
       * @throws UnsupportedOperationException if not supported by this collection
       */
      boolean setAllValues(int index, int[] values);
  
  }