Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Array

[18:7] extends: FxObj

Wraps FXGL's core Array (com.almasb.fxgl.core.collection.Array), a GDX-style growable array used as the return type by many FXGL APIs (ReflectionUtils.findFieldsByAnnotation, PhysicsWorld.getBodies, etc.). Provides the standard add / get / set / remove / iteration surface plus an ordered flag. Aussom code typically obtains one from an FXGL call and reads it with size() + get(i); the wrapper also exposes the mutators for callers that build an Array to pass back into FXGL.

Methods

  • Array ()

    Creates a new empty ordered Array.

  • adopt (object Ajo)

    Wraps an existing Array AussomJavaObject.

    • @p Ajo is an AussomJavaObject around an Array.
    • @r A new wrapper.
  • size ()

    Returns the element count.

  • isEmpty ()

    Returns true when the array is empty.

  • isNotEmpty ()

    Returns true when the array is non-empty.

  • isOrdered ()

    Returns true for ordered arrays (default).

  • get (int Index)

    Returns the element at Index.

  • add (object Value)

    Appends Value to the array.

  • set (int Index, object Value)

    Replaces the element at Index.

  • insert (int Index, object Value)

    Inserts Value at Index, shifting later elements right.

  • swap (int IndexA, int IndexB)

    Swaps the elements at IndexA and IndexB.

  • removeIndex (int Index)

    Removes the element at Index and returns it.

    • @r The removed element (raw AJO or primitive).
  • clear ()

    Removes every element. The array becomes empty.

  • first ()

    Returns the first element.

    • @r The element at index 0.
  • last ()

    Returns the last element (at size - 1).

  • pop ()

    Removes and returns the last element.

  • containsByIdentity (object Value)

    Returns true when Value is contained anywhere in the array (identity comparison).

  • toAussomList ()

    Converts this Array into a fresh Aussom list of raw AJOs. Convenient when callers want to iterate with Aussom for-loops.

    • @r An Aussom list.