// if the List "myList" doesn't contain an item named "option 1", add it.
if (!gui.hasItem("myList", "option 1")) {
gui.addItem("myList", "option 1"); // add an item to the List
} else {
println("The List already contains item 'option1'!");
}
Description
Queries whether a List or Choice element has an item of specified value.
Syntax
boolean result = gui.hasItem(name, item);
Parameters
String name
The name of the List or Choice element.
String item
The item to look for.
Returns
true if the element can be found, is either a Choice or a List element and has the specified item. False otherwise.