Returns a vector that contains the same objects as the array.

@param anArray the array to be converted
@return the new vector; if <code>anArray</code> is <code>null</code>, returns
<code>null</code>
162308
protected static Vector convertToVector(final Object[] anArray) {
		if (anArray == null) {
			return null;
		}
		final Vector v = new Vector(anArray.length);
		for (final Object element : anArray) {
			v.addElement(element);
		}
		return v;
	}
50860
public static boolean sameList(final Object[] a, final Object[] b) {
    if (a == null || b == null || a.length != b.length) {
      return false;
    }
    for (int i = 0; i < a.length; i++) {
      if (!a[i].equals(b[i])) {
        return false;
      }
    }
    return true;
  }
852693
public static Matrix constructWithCopy(double[][] A)
    {
        int m = A.length;
        int n = A[0].length;
        Matrix X = new Matrix(m, n);
        double[][] C = X.getArray();
        for (int i = 0; i < m; i++)
        {
            if (A[i].length != n)
            {
                throw new IllegalArgumentException
                        ("All rows must have the same length.");
            }
            for (int j = 0; j < n; j++)
            {
                C[i][j] = A[i][j];
            }
        }
        return X;
    }
557273
static public Object getByEquality(Object[] array, Object key)
    {
        if (array != null)
        {
            int length = array.length;

            for (int i = 0; i < length; i += 2)
            {
                Object targetKey = array[i];
                if (targetKey == null)
                {
                    return null;
                }
                else if (targetKey.equals(key))
                {
                    return array[i + 1];
                }
            }
        }

        return null;
    }
806785
public static Boolean[] toObjectArray(boolean arr[]){
        if(arr==null)
            return null;
        
        Boolean result[] = new Boolean[arr.length];
        for(int i=arr.length-1; i>=0; i--)
            result[i] = arr[i];
        return result;
    }
204450
public static Object duplicateArray(Object source) {

        int size = Array.getLength(source);
        Object newarray =
            Array.newInstance(source.getClass().getComponentType(), size);

        System.arraycopy(source, 0, newarray, 0, size);

        return newarray;
    }
50350
public Object nextElement() 
    {
        if (_array == null)
        {
            return null;
        }
        else
        {
            synchronized(this){
                if (_index < _array.length)
                {
                    Object obj = _array[_index];
                    _index++;
                    return obj;
                }
                else
                {
                    return null;
                }
            }
        }
    }
1154211
@SuppressWarnings("unchecked")
	public JSONNavi<T> array() {
		if (failure)
			return this;
		if (current == null && readonly)
			failure("Can not create Array child in readonly", null);
		if (current != null) {
			if (isArray())
				return this;
			if (isObject())
				failure("can not use Object feature on Array.", null);
			failure("Can not use current possition as Object", null);
		} else {
			current = mapper.createArray();
		}
		if (root == null)
			root = (T) current;
		else
			store();
		return this;
	}
1291047
public static Value bytesArray(@Nullable Iterable<ByteArray> v) {
    return new BytesArrayImpl(v == null, v == null ? null : immutableCopyOf(v));
  }
215266
public static String[] objectArrayToStringArray(final Object[] objectArray) {
		if( objectArray == null ) {
			return null;
		}
		
		final String[] stringArray = new String[objectArray.length];
		for( int i = 0; i < objectArray.length; i++ ) {
			stringArray[i] = objectArray[i] != null ? objectArray[i].toString() : null;
		}
		
		return stringArray;
	}
738621
protected Object newArray(Object old, int oldLen, Object arr)
    {
        int sb = Math.floorMod(begin, oldLen);
        int se = Math.floorMod(end, oldLen);
        if (sb < se)
        {
            System.arraycopy(old, sb, arr, sb, se - sb);
        }
        else
        {
            System.arraycopy(old, sb, arr, sb, oldLen - sb);
            System.arraycopy(old, 0, arr, 0, se);
        }
        return arr;
    }
512976
@Override
    public INDArray get(INDArrayIndex... indexes) {
        //check for row/column vector and point index being 0
        if (indexes.length == 1 && indexes[0] instanceof NDArrayIndexAll || (indexes.length == 2 && (isRowVector()
                        && indexes[0] instanceof PointIndex && indexes[0].offset() == 0
                        && indexes[1] instanceof NDArrayIndexAll
                        || isColumnVector() && indexes[1] instanceof PointIndex && indexes[0].offset() == 0
                                        && indexes[0] instanceof NDArrayIndexAll)))
            return this;

        indexes = NDArrayIndex.resolve(javaShapeInformation, indexes);

        throw new UnsupportedOperationException("Not implemeted");
    }
1331814
public static Object toPrimitiveArray(Object array) {
    if (!array.getClass().isArray()) {
      throw new IllegalArgumentException("Must give array object.");
    }
    if (isWrapperArray(array.getClass())) {
      int length = Array.getLength(array);
      Object newArray = Array.newInstance(toPrimitive(array.getClass().getComponentType()), length);
      for (int i = 0; i < length; i++) {
        Array.set(newArray, i, Array.get(array, i));
      }
      return newArray;
    } else if (array.getClass().getComponentType().isArray()) {
      int length = Array.getLength(array);
      Object newArray = Array.newInstance(toPrimitiveArray(array.getClass().getComponentType()), length);
      for (int i = 0; i < length; i++) {
        Array.set(newArray, i, toPrimitiveArray(Array.get(array, i)));
      }
      return newArray;
    }
    return array;
  }
1327913
public static String join(String[] array) {
    return array == null ? null : join(asList(array));
  }
792645
public Object getAsObject() {
		List<Object> result = new ArrayList<Object>();
		for (Object element : this)
			result.add(element);
		return result;
	}

	/**
	 * Sets a new value for this array element
	 * 
	 * @param value the new object value.
	 */
	public void setAsObject(Object value) {
		clear();
		List<Object> elements = ArrayConverter.toArray(value);
		append(elements);
	}

	/**
	 * Appends new elements to this array.
	 * 
	 * @param elements a list of elements to be added.
	 */
	public void append(Iterable<?> elements) {
		if (elements != null) {
			for (Object item : elements)
				add(item);
		}
	}

	/**
	 * Appends new elements to this array.
	 * 
	 * @param elements a list of elements to be added.
	 */
	public void append(Object[] elements) {
		if (elements != null) {
			for (Object item : elements)
				add(item);
		}
	}

	/**
	 * Gets an array element specified by its index.
	 * 
	 * @param index an index of the element to get.
	 * @return the value of the array element.
	 */
	public Object getAsObject(int index) {
		return get(index);
	}

	/**
	 * Sets a new value into array element specified by its index.
	 * 
	 * @param index an index of the element to put.
	 * @param value a new value for array element.
	 */
	public void setAsObject(int index, Object value) {
		set(index, value);
	}

//    @Override
//    public void add(Object value) {
//    	add(new AnyValue(value));
//    }

	/**
	 * Converts array element into a string or returns null if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return string value of the element or null if conversion is not supported.
	 * 
	 * @see StringConverter#toNullableString(Object)
	 */
	public String getAsNullableString(int index) {
		Object value = getAsObject(index);
		return StringConverter.toNullableString(value);
	}

	/**
	 * Converts array element into a string or returns "" if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return string value ot the element or "" if conversion is not supported.
	 * 
	 * @see #getAsStringWithDefault(int, String)
	 */
	public String getAsString(int index) {
		return getAsStringWithDefault(index, null);
	}

	/**
	 * Converts array element into a string or returns default value if conversion
	 * is not possible.
	 * 
	 * @param index        an index of element to get.
	 * @param defaultValue the default value
	 * @return string value ot the element or default value if conversion is not
	 *         supported.
	 * 
	 * @see StringConverter#toStringWithDefault(Object, String)
	 */
	public String getAsStringWithDefault(int index, String defaultValue) {
		Object value = getAsObject(index);
		return StringConverter.toStringWithDefault(value, defaultValue);
	}

	/**
	 * Converts array element into a boolean or returns null if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return boolean value of the element or null if conversion is not supported.
	 * 
	 * @see BooleanConverter#toNullableBoolean(Object)
	 */
	public Boolean getAsNullableBoolean(int index) {
		Object value = getAsObject(index);
		return BooleanConverter.toNullableBoolean(value);
	}

	/**
	 * Converts array element into a boolean or returns false if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return boolean value ot the element or false if conversion is not supported.
	 * 
	 * @see #getAsBooleanWithDefault(int, boolean)
	 */
	public Boolean getAsBoolean(int index) {
		return getAsBooleanWithDefault(index, false);
	}

	/**
	 * Converts array element into a boolean or returns default value if conversion
	 * is not possible.
	 * 
	 * @param index        an index of element to get.
	 * @param defaultValue the default value
	 * @return boolean value ot the element or default value if conversion is not
	 *         supported.
	 * 
	 * @see BooleanConverter#toBooleanWithDefault(Object, boolean)
	 */
	public boolean getAsBooleanWithDefault(int index, boolean defaultValue) {
		Object value = getAsObject(index);
		return BooleanConverter.toBooleanWithDefault(value, defaultValue);
	}

	/**
	 * Converts array element into an integer or returns null if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return integer value of the element or null if conversion is not supported.
	 * 
	 * @see IntegerConverter#toNullableInteger(Object)
	 */
	public Integer getAsNullableInteger(int index) {
		Object value = getAsObject(index);
		return IntegerConverter.toNullableInteger(value);
	}

	/**
	 * Converts array element into an integer or returns 0 if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return integer value ot the element or 0 if conversion is not supported.
	 * 
	 * @see #getAsIntegerWithDefault(int, int)
	 */
	public int getAsInteger(int index) {
		return getAsIntegerWithDefault(index, 0);
	}

	/**
	 * Converts array element into an integer or returns default value if conversion
	 * is not possible.
	 * 
	 * @param index        an index of element to get.
	 * @param defaultValue the default value
	 * @return integer value ot the element or default value if conversion is not
	 *         supported.
	 * 
	 * @see IntegerConverter#toIntegerWithDefault(Object, int)
	 */
	public int getAsIntegerWithDefault(int index, int defaultValue) {
		Object value = getAsObject(index);
		return IntegerConverter.toIntegerWithDefault(value, defaultValue);
	}

	/**
	 * Converts array element into a long or returns null if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return long value of the element or null if conversion is not supported.
	 * 
	 * @see LongConverter#toNullableLong(Object)
	 */
	public Long getAsNullableLong(int index) {
		Object value = getAsObject(index);
		return LongConverter.toNullableLong(value);
	}

	/**
	 * Converts array element into a long or returns 0 if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return long value ot the element or 0 if conversion is not supported.
	 * 
	 * @see #getAsLongWithDefault(int, long)
	 */
	public long getAsLong(int index) {
		return getAsLongWithDefault(index, 0);
	}

	/**
	 * Converts array element into a long or returns default value if conversion is
	 * not possible.
	 * 
	 * @param index        an index of element to get.
	 * @param defaultValue the default value
	 * @return long value ot the element or default value if conversion is not
	 *         supported.
	 * 
	 * @see LongConverter#toLongWithDefault(Object, long)
	 */
	public long getAsLongWithDefault(int index, long defaultValue) {
		Object value = getAsObject(index);
		return LongConverter.toLongWithDefault(value, defaultValue);
	}

	/**
	 * Converts array element into a float or returns null if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return float value of the element or null if conversion is not supported.
	 * 
	 * @see FloatConverter#toNullableFloat(Object)
	 */
	public Float getAsNullableFloat(int index) {
		Object value = getAsObject(index);
		return FloatConverter.toNullableFloat(value);
	}

	/**
	 * Converts array element into a float or returns 0 if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return float value ot the element or 0 if conversion is not supported.
	 * 
	 * @see #getAsFloatWithDefault(int, float)
	 */
	public float getAsFloat(int index) {
		return getAsFloatWithDefault(index, 0);
	}

	/**
	 * Converts array element into a float or returns default value if conversion is
	 * not possible.
	 * 
	 * @param index        an index of element to get.
	 * @param defaultValue the default value
	 * @return float value ot the element or default value if conversion is not
	 *         supported.
	 * 
	 * @see FloatConverter#toFloatWithDefault(Object, float)
	 */
	public float getAsFloatWithDefault(int index, float defaultValue) {
		Object value = getAsObject(index);
		return FloatConverter.toFloatWithDefault(value, defaultValue);
	}

	/**
	 * Converts array element into a double or returns null if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return double value of the element or null if conversion is not supported.
	 * 
	 * @see DoubleConverter#toNullableDouble(Object)
	 */
	public Double getAsNullableDouble(int index) {
		Object value = getAsObject(index);
		return DoubleConverter.toNullableDouble(value);
	}

	/**
	 * Converts array element into a double or returns 0 if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return double value ot the element or 0 if conversion is not supported.
	 * 
	 * @see #getAsDoubleWithDefault(int, double)
	 */
	public double getAsDouble(int index) {
		return getAsDoubleWithDefault(index, 0);
	}

	/**
	 * Converts array element into a double or returns default value if conversion
	 * is not possible.
	 * 
	 * @param index        an index of element to get.
	 * @param defaultValue the default value
	 * @return double value ot the element or default value if conversion is not
	 *         supported.
	 * 
	 * @see DoubleConverter#toDoubleWithDefault(Object, double)
	 */
	public double getAsDoubleWithDefault(int index, double defaultValue) {
		Object value = getAsObject(index);
		return DoubleConverter.toDoubleWithDefault(value, defaultValue);
	}

	/**
	 * Converts array element into a Date or returns null if conversion is not
	 * possible.
	 * 
	 * @param index an index of element to get.
	 * @return ZonedDateTime value of the element or null if conversion is not supported.
	 * 
	 * @see DateTimeConverter#toNullableDateTime(Object)
	 */
	public ZonedDateTime getAsNullableDateTime(int index) {
		Object value = getAsObject(index);
		return DateTimeConverter.toNullableDateTime(value);
	}

	/**
	 * Converts array element into a Date or returns the current date if conversion
	 * is not possible.
	 * 
	 * @param index an index of element to get.
	 * @return ZonedDateTime value ot the element or the current date if conversion is not
	 *         supported.
	 * 
	 * @see #getAsDateTimeWithDefault(int, ZonedDateTime)
	 */
	public ZonedDateTime getAsDateTime(int index) {
		return getAsDateTimeWithDefault(index, null);
	}

	/**
	 * Converts array element into a Date or returns default value if conversion is
	 * not possible.
	 * 
	 * @param index        an index of element to get.
	 * @param defaultValue the default value
	 * @return ZonedDateTime value ot the element or default value if conversion is not
	 *         supported.
	 * 
	 * @see DateTimeConverter#toDateTimeWithDefault(Object, ZonedDateTime)
	 */
	public ZonedDateTime getAsDateTimeWithDefault(int index, ZonedDateTime defaultValue) {
		Object value = getAsObject(index);
		return DateTimeConverter.toDateTimeWithDefault(value, defaultValue);
	}

	public Duration getAsNullableDuration(int index) {
		Object value = getAsObject(index);
		return DurationConverter.toNullableDuration(value);
	}

	public Duration getAsDuration(int index) {
		return getAsDurationWithDefault(index, null);
	}

	public Duration getAsDurationWithDefault(int index, Duration defaultValue) {
		Object value = getAsObject(index);
		return DurationConverter.toDurationWithDefault(value, defaultValue);
	}

	public <T extends Enum<T>> T getAsNullableEnum(Class<T> type, int index) {
		Object value = getAsObject(index);
		return EnumConverter.toNullableEnum(type, value);
	}

	public <T extends Enum<T>> T getAsEnum(Class<T> type, int index) {
		return getAsEnumWithDefault(type, index, null);
	}

	public <T extends Enum<T>> T getAsEnumWithDefault(Class<T> type, int index, T defaultValue) {
		Object value = getAsObject(index);
		return EnumConverter.toEnumWithDefault(type, value, defaultValue);
	}

	/**
	 * Converts array element into a value defined by specied typecode. If
	 * conversion is not possible it returns null.
	 * 
	 * @param type  the Class type that defined the type of the result
	 * @param index an index of element to get.
	 * @return element value defined by the typecode or null if conversion is not
	 *         supported.
	 * 
	 * @see TypeConverter#toNullableType(Class, Object)
	 */
	public <T> T getAsNullableType(Class<T> type, int index) {
		Object value = getAsObject(index);
		return TypeConverter.toNullableType(type, value);
	}

	/**
	 * Converts array element into a value defined by specied typecode. If
	 * conversion is not possible it returns default value for the specified type.
	 * 
	 * @param type  the Class type that defined the type of the result
	 * @param index an index of element to get.
	 * @return element value defined by the typecode or default if conversion is not
	 *         supported.
	 * 
	 * @see #getAsTypeWithDefault(Class, int, Object)
	 */
	public <T> T getAsType(Class<T> type, int index) {
		return getAsTypeWithDefault(type, index, null);
	}

	/**
	 * Converts array element into a value defined by specied typecode. If
	 * conversion is not possible it returns default value.
	 * 
	 * @param type         the Class type that defined the type of the result
	 * @param index        an index of element to get.
	 * @param defaultValue the default value
	 * @return element value defined by the typecode or default value if conversion
	 *         is not supported.
	 * 
	 * @see TypeConverter#toTypeWithDefault(Class, Object, Object)
	 */
	public <T> T getAsTypeWithDefault(Class<T> type, int index, T defaultValue) {
		Object value = getAsObject(index);
		return TypeConverter.toTypeWithDefault(type, value, defaultValue);
	}

	/**
	 * Converts array element into an AnyValue or returns an empty AnyValue if
	 * conversion is not possible.
	 * 
	 * @param index an index of element to get.
	 * @return AnyValue value of the element or empty AnyValue if conversion is not
	 *         supported.
	 * 
	 * @see AnyValue
	 * @see AnyValue#AnyValue(Object)
	 */
	public AnyValue getAsValue(int index) {
		Object value = getAsObject(index);
		return new AnyValue(value);
	}

	/**
	 * Converts array element into an AnyValueArray or returns null if conversion is
	 * not possible.
	 * 
	 * @param index an index of element to get.
	 * @return AnyValueArray value of the element or null if conversion is not
	 *         supported.
	 * 
	 * @see #fromValue(Object)
	 */
	public AnyValueArray getAsNullableArray(int index) {
		Object value = getAsObject(index);
		return value != null ? AnyValueArray.fromValue(value) : null;
	}

	/**
	 * Converts array element into an AnyValueArray or returns empty AnyValueArray
	 * if conversion is not possible.
	 * 
	 * @param index an index of element to get.
	 * @return AnyValueArray value of the element or empty AnyValueArray if
	 *         conversion is not supported.
	 * 
	 * @see #fromValue(Object)
	 */
	public AnyValueArray getAsArray(int index) {
		Object value = getAsObject(index);
		return AnyValueArray.fromValue(value);
	}

	/**
	 * Converts array element into an AnyValueArray or returns default value if
	 * conversion is not possible.
	 * 
	 * @param index        an index of element to get.
	 * @param defaultValue the default value
	 * @return AnyValueArray value of the element or default value if conversion is
	 *         not supported.
	 * 
	 * @see #getAsNullableArray(int)
	 */
	public AnyValueArray getAsArrayWithDefault(int index, AnyValueArray defaultValue) {
		AnyValueArray result = getAsNullableArray(index);
		return result != null ? result : defaultValue;
	}

	/**
	 * Converts array element into an AnyValueMap or returns null if conversion is
	 * not possible.
	 * 
	 * @param index an index of element to get.
	 * @return AnyValueMap value of the element or null if conversion is not
	 *         supported.
	 * 
	 * @see AnyValueMap
	 * @see AnyValueMap#fromValue(Object)
	 */
	public AnyValueMap getAsNullableMap(int index) {
		Object value = getAsObject(index);
		return value != null ? AnyValueMap.fromValue(value) : null;
	}

	/**
	 * Converts array element into an AnyValueMap or returns empty AnyValueMap if
	 * conversion is not possible.
	 * 
	 * @param index an index of element to get.
	 * @return AnyValueMap value of the element or empty AnyValueMap if conversion
	 *         is not supported.
	 * 
	 * @see AnyValueMap
	 * @see AnyValueMap#fromValue(Object)
	 */
	public AnyValueMap getAsMap(int index) {
		Object value = getAsObject(index);
		return AnyValueMap.fromValue(value);
	}

	/**
	 * Converts array element into an AnyValueMap or returns default value if
	 * conversion is not possible.
	 * 
	 * @param index        an index of element to get.
	 * @param defaultValue the default value
	 * @return AnyValueMap value of the element or default value if conversion is
	 *         not supported.
	 * 
	 * @see #getAsNullableMap(int)
	 */
	public AnyValueMap getAsMapWithDefault(int index, AnyValueMap defaultValue) {
		AnyValueMap result = getAsNullableMap(index);
		return result != null ? AnyValueMap.fromValue(result) : defaultValue;
	}

	/**
	 * Checks if this array contains a value. The check uses direct comparison
	 * between elements and the specified value.
	 * 
	 * @param value a value to be checked
	 * @return true if this array contains the value or false otherwise.
	 */
	public boolean contains(Object value) {
		for (Object element : this) {
			if (value == null && element == null)
				return true;
			if (value == null || element == null)
				continue;
			if (value.equals(element))
				return true;
		}

		return false;
	}

	/**
	 * Checks if this array contains a value. The check before comparison converts
	 * elements and the value to type specified by type code.
	 * 
	 * @param type  a Class type that defines a type to convert values before
	 *              comparison
	 * @param value a value to be checked
	 * @return true if this array contains the value or false otherwise.
	 * 
	 * @see TypeConverter#toType(Class, Object)
	 * @see TypeConverter#toNullableType(Class, Object)
	 */
	public <T> boolean containsAsType(Class<T> type, Object value) {
		T typedValue = TypeConverter.toType(type, value);

		for (Object thisValue : this) {
			T thisTypedValue = TypeConverter.toNullableType(type, thisValue);

			if (typedValue == null && thisTypedValue == null)
				return true;
			if (typedValue == null || thisTypedValue == null)
				continue;
			if (typedValue.equals(thisTypedValue))
				return true;
		}

		return false;
	}

	/**
	 * Creates a binary clone of this object.
	 * 
	 * @return a clone of this object.
	 */
	public Object clone() {
		return new AnyValueArray(this);
	}

	/**
	 * Gets a string representation of the object. The result is a comma-separated
	 * list of string representations of individual elements as
	 * "value1,value2,value3"
	 * 
	 * @return a string representation of the object.
	 *
	 * @see StringConverter#toString()
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		for (int index = 0; index < size(); index++) {
			if (index > 0)
				builder.append(',');
			builder.append(getAsStringWithDefault(index, ""));
		}
		return builder.toString();
	}

	/**
	 * Creates a new AnyValueArray from a list of values
	 * 
	 * @param values a list of values to initialize the created AnyValueArray
	 * @return a newly created AnyValueArray.
	 */
	public static AnyValueArray fromValues(Object... values) {
		return new AnyValueArray(values);
	}

	/**
	 * Converts specified value into AnyValueArray.
	 * 
	 * @param value value to be converted
	 * @return a newly created AnyValueArray.
	 * 
	 * @see ArrayConverter#toNullableArray(Object)
	 */
	public static AnyValueArray fromValue(Object value) {
		List<Object> values = ArrayConverter.toNullableArray(value);
		return new AnyValueArray(values);
	}

	/**
	 * Splits specified string into elements using a separator and assigns the
	 * elements to a newly created AnyValueArray.
	 * 
	 * @param values           a string value to be split and assigned to
	 *                         AnyValueArray
	 * @param separator        a separator to split the string
	 * @param removeDuplicates (optional) true to remove duplicated elements
	 * @return a newly created AnyValueArray.
	 */
	public static AnyValueArray fromString(String values, String separator, boolean removeDuplicates) {
		AnyValueArray result = new AnyValueArray();

		if (values == null || values.length() == 0)
			return result;

		String[] items = values.split(separator, -1);
		for (String item : items) {
			if ((item != null && item.length() > 0) || removeDuplicates == false)
				result.add(item != null ? new AnyValue(item) : null);
		}

		return result;
	}

	/**
	 * Splits specified string into elements using a separator and assigns the
	 * elements to a newly created AnyValueArray.
	 * 
	 * @param values    a string value to be split and assigned to AnyValueArray
	 * @param separator a separator to split the string
	 * @return a newly created AnyValueArray.
	 */
	public static AnyValueArray fromString(String values, String separator) {
		return AnyValueArray.fromString(values, separator, false);
	}
}
1298239
public static Value stringArray(@Nullable Iterable<String> v) {
    return new StringArrayImpl(v == null, v == null ? null : immutableCopyOf(v));
  }
819565
@Nullable
  public static int[] getIntArray(@Nullable final JsonArray array) {
    if (null == array) return null;
    return IntStream.range(0, array.size()).map(i -> array.get(i).getAsInt()).toArray();
  }