code: @SuppressWarnings("unchecked")
      public static void setIndex(Object array, int index, Object val)
              throws ReflectError, UtilTargetError {
          try {
              val = Primitive.unwrap(val);
              if ( array instanceof List )
                  ((List<Object>) array).set(index, val);
              else
                  Array.set(array, index, val);
          }
          catch( IllegalArgumentException e1 ) {
              // fabricated array store exception
              throw new UtilTargetError(
                  new ArrayStoreException( e1.getMessage() ) );
          } catch( IndexOutOfBoundsException e1 ) {
              int len = array instanceof List
                      ? ((List<?>) array).size()
                      : Array.getLength(array);
              throw new UtilTargetError("Index " + index
                      + " out-of-bounds for length " + len, e1);
          }
      }
docs: Set element value of array or list at index.
  Array.set for array or List.set for list.
  @param array to set value for.
  @param index of the element to set
  @param val the value to set
  @throws UtilTargetError wrapped target exceptions