Skip to content

StringList

youyihj edited this page Aug 31, 2022 · 3 revisions

StringList

StringList is like List<String>, but a little different.

Importing the package

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import. import mods.zenutils.StringList;

Creating a StringList

StringList.create(Collection<?> list)
StringList.create(Object[] objects)
StringList.empty()
StringList.singletonList(Object object)

ZenMethods

  • String get(int index)
  • String set(int index, Object obj) -> returns the old element in the index
  • boolean add(Object obj)
  • boolean remove(Object obj)
  • boolean contains(Object obj)
  • boolean add(String s)
  • boolean remove(String s)
  • contains(String s)
  • void clear()
  • boolean removeIf(StringPredicate filter) -> removes all of the strings that match the given predicate. Returns true if any strings were removed.

Interating the list

You can interate it. Such as ...

import mods.zenutils.StringList;

val l as StringList = StringList.empty();
l.add("41");
l.add(6);
l.add(<ore:ingotIron>);

for s in l {
    print(s);
}
Clone this wiki locally