/**
* This file is auto generated from JavaDoc. Do not modify it manually.
*/
import type { Object } from "../../types/java/lang/Object";
import type { Iterator } from "../../types/java/util/Iterator";
import type { Comparator } from "../../types/java/util/Comparator";
import type { List } from "../../types/java/util/List";
import type { Iterable } from "../../types/java/lang/Iterable";
import type { Wrapper } from "../../types/senselogic/sitevision/api/base/Wrapper";
/**
* An convenience java.util.List wrapper that delegates method calls to the wrapped list.
*
*
* This is a convenience wrapper that bypasses potential problems with the add method of a java.util.List.
* The List.add method accepts null values and returns a boolean.
* When working with Velocity, this boolean gets part of the output if not suppressed via a #set, #if,
* #elseif or via {@link senselogic.sitevision.api.script.ScriptUtil#swallow(Object)})
*
* An example with the add problem of a java.util.List:
This Velocity code:
*
* #set ($myList = $instanceCreatorUtil.list)
* $myList.add("Magnus Lövgren") ## Returns true
* $myList.add("Mikael Wikblom") ## Returns true
*
* $someObject.someMethod($myList)will result in the following Velocity output
* (the add method of List returns a boolean):
* true true
*
* If a non-void method is invoked and the return value isn't handled, it will be part of the Velocity output.
* Using an ListWrapper will prevent that:
*
* #set ($myList = $instanceCreatorUtil.listWrapper)
* myList.add("Magnus Lövgren") ## Silent
* myList.add("Mikael Wikblom") ## Silent
*
* $someObject.someMethod($myList.unwrap()) ## Get wrapped List
*
*
*
* Important Velocity #foreach note!
* Iterating a ListWrapper via the Velocity #foreach loop is not possible in all Velocity versions
* (proper Iterable support not present). To ensure proper #foreach iteration in all Velocity versions,
* you should use one of the following alternative ways:
*
* #set ($myList = $instanceCreatorUtil.listWrapper)
* ...
*
* ## ALTERNATIVE A - unwrap, i.e. do actual iteration on the wrapped list itself
* #foreach ($item in $myList.unwrap())
* ...
* #end
*
* ## ALTERNATIVE B - explicitly hand over the Iterator
* #foreach ($item in $myList.iterator())
* ...
* #end
*
* ## ALTERNATIVE C - extract as array
* #foreach ($item in $myList.toArray())
* ...
* #end
* * For best performance, you should choose alternative A or B over C. *
* *
* An instance of the Sitevision class implementing this interface can be obtained via {@link InstanceCreatorUtil#getListWrapper()}.
* See {@link InstanceCreatorUtil} for how to obtain an instance of the InstanceCreatorUtil interface.
*
* Important! Null values in lists are inherently bad. This method will not
* delegate any null to the wrapped list.
* If you must add a null value, you can explicitly do it to the wrapped list, i.e:
*
* #set ($myList = $instanceCreatorUtil.listWrapper)
* ...
* $myList.add($anObject.aMethod()) ## Will only delegate non-nulls to the wrapped list
* $myList.unwrap().add($anObject.aMethod()) ## Will add any value directly to the wrapped list
*
* @param anObject the element to be appended to the wrapped list, null will be ignored.
*/
add(anObject: unknown): void;
/**
* Removes all of the elements from the wrapped list.
*/
clear(): void;
/**
* Checks if the wrapped list contains a specified object.
* @param anObject an element to check for in the wrapped list.
* @return true if the wrapped list contains the specified element
*/
contains(anObject: unknown): boolean;
/**
* Returns the element at the specified position in the wrapped list.
* @param anIndex index of the element in the wrapped list to return
* @return the element at the specified position in the wrapped list
* @throws IndexOutOfBoundsException if the index is out of range (index < 0 || index >= size())
*/
get(anIndex: number): unknown;
/**
* Whether or not the wrapped list is empty (contains no elements).
* @return true if the wrapped list contains no elements
*/
isEmpty(): boolean;
/**
* Returns an iterator for the wrapped list.
* @return an Iterator.
*/
iterator(): Iterator;
/**
* The size (number of elements) of the wrapped list.
* @return the number of elements in the wrapped list
*/
size(): number;
/**
* Returns an array containing all of the elements in the wrapped list.
* @return an array containing the elements of the wrapped list
*/
toArray(): unknown;
/**
* Sorts the wrapped list.
* @param aComparator the comparator to use when sorting
* @since Sitevision 4.0
*/
sort(aComparator: Comparator): void;
/**
* Returns the wrapped List.
* @return the List wrapped by this ListWrapper
*/
unwrap(): List;
}
declare namespace ListWrapper {}
declare var listWrapper: ListWrapper;
export default listWrapper;