Class StaticInteger

  • All Implemented Interfaces:
    Arrayable<java.lang.Integer>

    public class StaticInteger
    extends StaticArray<java.lang.Integer>
    A specialized static array type designed to reduce clutter in code (and the amount of those damn diamond brackets).

    This class doesn't actually provide any utility other than making it easier to construct and access a specific type of static array.

    Author:
    Colin Robertson
    • Constructor Detail

      • StaticInteger

        public StaticInteger​(int size)
        Create a new static array.

        Please note that when creating a static array, it is VERY STRONGLY suggested that you make use of the constructor that accepts an array as a parameter. Upcasting may sometimes cause issues here, which can be very frustrating to debug.

        Parameters:
        size - how large the array should be.
      • StaticInteger

        public StaticInteger​(java.lang.Integer... elements)
        Create a new static array.
        Parameters:
        elements - the array that the static array should use. This array WILL NOT be copied. Remember, arrays are MUTABLE objects, meaning that any reference to them returns the same object. If you create a static array WITHOUT copying the array, the array you passed to this constructor will be the static array's array - modifying the array via the methods in this class will modify that array as well.
      • StaticInteger

        public StaticInteger​(Arrayable<java.lang.Integer> arrayable)
        Create a new StaticArray instance by using an Arrayable object to get the newly-created static array's contents.
        Parameters:
        arrayable - the array object that should be the base of the new dynamic array. Ex: StaticArray instance.