Type Hierarchy:
Satisfied Interfaces: Category, Cloneable<Collection<Element>>, Collection<Element>, Container<Element,Absent>, Correspondence<Integer,Element>, Iterable<Element,Null>, List<Element>, MutableList<String|Boolean|Integer|Float|Object|Array|NullInstance>, Ranged<Integer,List<Element>>

Represents a JSON Array

By: Stéphane Épardaud
Initializer
Array({<String|Boolean|Integer|Float|Object|Array|NullInstance>*} values= {})
Attributes
arraysSource Code
shared {Array*} arrays

Returns this array as a sequence of Array elements.

Throws:
booleansSource Code
shared {Boolean*} booleans

Returns this array as a sequence of Boolean elements.

Throws:
cloneSource Code
shared actual Array clone

Obtain a clone of this object. For a mutable object, this should return a copy of the object. For an immutable object, it is acceptable to return the object itself.

Refined declaration: clone
floatsSource Code
shared {Float*} floats

Returns this array as a sequence of Float elements.

Throws:
hashSource Code
shared actual Integer hash

The hash value of the value, which allows the value to be an element of a hash-based set or key of a hash-based map. Implementations must respect the constraint that if x==y then x.hash==y.hash.

Refined declaration: hash
integersSource Code
shared {Integer*} integers

Returns this array as a sequence of Integer elements.

Throws:
lastIndexSource Code
shared actual Integer? lastIndex

The index of the last element of the list, or null if the list is empty.

Refined declaration: lastIndex
objectsSource Code
shared {Object*} objects

Returns this array as a sequence of Object elements.

Throws:
prettySource Code
shared String pretty

Returns a pretty-printed serialised JSON representation

restSource Code
shared actual Array rest

Returns an iterable object containing all but the first element of this container.

Refined declaration: rest
reversedSource Code
shared actual Array reversed

Reverse this list, returning a new list.

Refined declaration: reversed
sizeSource Code
shared actual Integer size

Returns the number of elements in this array

Refined declaration: size
stringSource Code
shared actual String string

Returns a serialised JSON representation

Refined declaration: string
stringsSource Code
shared {String*} strings

Returns this array as a sequence of String elements.

Throws:
Inherited Attributes
Attributes inherited from: Cloneable<Clone>
clone
Attributes inherited from: Collection<Element>
empty, string
Attributes inherited from: Container<Element,Absent>
empty, first, last
Attributes inherited from: Correspondence<Key,Item>
keys
Attributes inherited from: Iterable<Element,Absent>
coalesced, cycled, indexed, rest, sequence, size, string
Attributes inherited from: List<Element>
first, hash, last, lastIndex, rest, reversed, size
Methods
addSource Code
shared actual void add(String|Boolean|Integer|Float|Object|Array|NullInstance val)

Adds a new value at the end of this array

Refined declaration: add
addAllSource Code
shared actual void addAll({<String|Boolean|Integer|Float|Object|Array|NullInstance>*} values)

Add the given items to the end of this list.

Refined declaration: addAll
clearSource Code
shared actual void clear()

Remove every item from this list, leaving an empty list.

Refined declaration: clear
equalsSource Code
shared actual Boolean equals(Object that)

Determine if two values are equal. Implementations should respect the constraints that:

  • if x===y then x==y (reflexivity),
  • if x==y then y==x (symmetry),
  • if x==y and y==z then x==z (transitivity).

Furthermore it is recommended that implementations ensure that if x==y then x and y have the same concrete class.

Refined declaration: equals
getSource Code
shared actual String|Boolean|Integer|Float|Object|Array|NullInstance|Null get(Integer index)

Gets the value at the given index, or null if it does not exist

Refined declaration: get
insertSource Code
shared actual void insert(Integer index, String|Boolean|Integer|Float|Object|Array|NullInstance val)

Insert the given item at the specified index. The list is expanded if index > size.

Refined declaration: insert
iteratorSource Code
shared actual Iterator<String|Boolean|Integer|Float|Object|Array|NullInstance> iterator()

An iterator for the elements belonging to this container.

Refined declaration: iterator
removeSource Code
shared actual void remove(Integer index)

Remove the item at the specified index.

Refined declaration: remove
removeElementSource Code
shared actual void removeElement(String|Boolean|Integer|Float|Object|Array|NullInstance val)

Remove all occurrences of the given value from this list.

Refined declaration: removeElement
segmentSource Code
shared actual Array segment(Integer from, Integer length)

Obtain a segment containing the mapped values starting from the given index, with the given length.

Refined declaration: segment
setSource Code
shared actual void set(Integer index, String|Boolean|Integer|Float|Object|Array|NullInstance val)

Set the item at the given index in this list. The list is expanded if index > size.

Refined declaration: set
spanSource Code
shared actual Array span(Integer from, Integer to)

Obtain a span containing the mapped values between the two given indices.

Refined declaration: span
spanFromSource Code
shared actual Array spanFrom(Integer from)

Obtain a span containing the mapped values between the starting index and the end of the receiver.

Refined declaration: spanFrom
spanToSource Code
shared actual Array spanTo(Integer to)

Obtain a span containing the mapped values between the start of the receiver and the end index.

Refined declaration: spanTo
Inherited Methods
Methods inherited from: Category
contains, containsAny, containsEvery
Methods inherited from: Collection<Element>
contains
Methods inherited from: Correspondence<Key,Item>
defines, definesAny, definesEvery, get, items
Methods inherited from: Iterable<Element,Absent>
any, by, chain, collect, count, cycle, defaultNullElements, every, filter, find, findLast, fold, following, iterator, longerThan, map, repeat, select, shorterThan, skipping, skippingWhile, sort, taking, takingWhile
Methods inherited from: List<Element>
endsWith, equals, findLast, firstInclusion, firstOccurrence, includes, includesAt, inclusions, indexes, initial, iterator, lastInclusion, lastOccurrence, longerThan, occurrences, occurs, occursAt, shorterThan, startsWith, terminal, trim, trimLeading, trimTrailing, withLeading, withTrailing
Methods inherited from: MutableList<Element>
add, addAll, clear, insert, remove, removeElement, set
Methods inherited from: Ranged<Index,Span>
segment, span, spanFrom, spanTo