Class ImmutableArray
java.lang.Object
ortus.boxlang.runtime.types.Array
ortus.boxlang.runtime.types.immutable.ImmutableArray
- All Implemented Interfaces:
Serializable
,Iterable<Object>
,Collection<Object>
,List<Object>
,SequencedCollection<Object>
,IReferenceable
,IImmutable
,IType
,IListenable
Represents an immutable Array. All data you want needs to be passed in the constructor or
provided to a static creation method. Once instantiated, the Array cannot be modified. An
exception will be thrown if you invoke any mutator method.
- See Also:
-
Field Summary
Fields inherited from class ortus.boxlang.runtime.types.Array
$bx, containsDelimiters, EMPTY, wrapped
Fields inherited from interface ortus.boxlang.runtime.types.meta.IListenable
ALL_KEYS
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor to create default arrayImmutableArray
(int initialCapactity) Constructor to create array with an initial capacityImmutableArray
(Object[] arr) Constructor to create a Array from a Java arrayImmutableArray
(List<? extends Object> list) Constructor to create a Array from a List -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(int index, Collection<? extends Object> c) boolean
addAll
(Collection<? extends Object> c) int
assign
(IBoxContext context, Key key, Object value) Assign a value to a keyvoid
clear()
Clears the contents contents of the arraystatic ImmutableArray
Create a Array from a Java arraystatic ImmutableArray
Create a Array from a Liststatic ImmutableArray
Create a Array from a list of values.remove
(int index) Remove an element at a specified indexboolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) To MutableMethods inherited from class ortus.boxlang.runtime.types.Array
add, asString, contains, containsAll, copyOf, deleteAt, dereference, dereferenceAndInvoke, dereferenceAndInvoke, equals, findIndex, findIndex, findIndex, findIndexWithSubstring, fromString, fromString, get, getAt, getBoxMeta, getIntFromKey, hashCode, indexOf, insertAt, intStream, isEmpty, iterator, lastIndexOf, listIterator, listIterator, parallelStream, push, registerChangeListener, registerChangeListener, removeAt, removeChangeListener, removeDuplicates, removeDuplicates, reverse, set, setAt, size, sort, stream, subList, toArray, toArray, toImmutable, toList, toString, validateAndGetIntForAssign, validateAndGetIntForDereference, withDelimiters
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
removeIf, toArray
Methods inherited from interface java.util.List
addFirst, addLast, getFirst, getLast, removeFirst, removeLast, replaceAll, reversed, spliterator
-
Constructor Details
-
ImmutableArray
public ImmutableArray()Constructor to create default array -
ImmutableArray
public ImmutableArray(int initialCapactity) Constructor to create array with an initial capacity- Parameters:
initialCapactity
- The initialCapactity of Array to create
-
ImmutableArray
Constructor to create a Array from a Java array- Parameters:
arr
- The array to create the Array from
-
ImmutableArray
Constructor to create a Array from a List- Parameters:
list
- The List to create the Array from
-
-
Method Details
-
toMutable
To Mutable- Specified by:
toMutable
in interfaceIImmutable
- Returns:
- The mutable type
-
fromList
Create a Array from a List- Parameters:
list
- The List to create the Array from
-
fromArray
Create a Array from a Java array- Parameters:
arr
- The array to create the Array from
-
of
Create a Array from a list of values.- Parameters:
values
- The values to create the Array from- Returns:
- The Array
-
add
-
remove
-
addAll
-
addAll
-
removeAll
-
retainAll
-
clear
public void clear()Description copied from class:Array
Clears the contents contents of the array -
remove
Description copied from class:Array
Remove an element at a specified index -
append
-
assign
Assign a value to a key- Specified by:
assign
in interfaceIReferenceable
- Overrides:
assign
in classArray
- Parameters:
context
- The context we're executing inside ofkey
- The key to assignvalue
- The value to assign- Returns:
- The assigned value
-