Interface IElementArrayContainer<ITEM>


  • public interface IElementArrayContainer<ITEM>
    Interface implements by containers that can contain elements of some kind.
    Author:
    Christopher Mindus
    • Method Detail

      • getElementArrayContainer

        default IElementArrayContainer<ITEM> getElementArrayContainer()
        Gets the target implementor of the interface.
        Returns:
        The target implements of the interface, null for none (this instance).
      • getItemCount

        default int getItemCount()
        Gets the item count.
        Returns:
        The count of items.
      • sortItems

        default void sortItems()
        Sorts the list according to the default JVM locale case sensitively.
        Throws:
        java.lang.IllegalStateException - If the container is read-only.
      • sortItems

        default void sortItems​(boolean isCaseInsensitive)
        Sorts the list according to the default JVM locale.
        Parameters:
        isCaseInsensitive - Flag for case insensitive.
        Throws:
        java.lang.IllegalStateException - If the container is read-only.
      • sortItems

        default void sortItems​(java.util.Locale locale)
        Sorts the list according to a locale case sensitively.
        Parameters:
        locale - The locale to use for string sorting.
        Throws:
        java.lang.IllegalStateException - If the container is read-only.
      • sortItems

        default void sortItems​(java.util.Locale locale,
                               boolean isCaseInsensitive)
        Sorts the list according to a locale.
        Parameters:
        locale - The locale to use for string sorting, null for default..
        isCaseInsensitive - Flag for case insensitive.
        Throws:
        java.lang.IllegalStateException - If the container is read-only.
      • addItem

        default void addItem​(ITEM item)
        Adds a new item.
        Parameters:
        item - The item to add.
        Throws:
        java.lang.NullPointerException - If the item is null.
        java.lang.IllegalStateException - If the container is read-only.
      • addItems

        default void addItems​(ITEM... items)
        Adds a new items.
        Parameters:
        items - The items to add.
        Throws:
        java.lang.NullPointerException - If an item is null.
        java.lang.IllegalStateException - If the container is read-only.
      • insertItem

        default void insertItem​(ITEM item,
                                int index)
        Inserts an item at specified index.
        Parameters:
        item - The item to add.
        index - The index to insert the item before (-1 for last).
        Throws:
        java.lang.NullPointerException - If the item is null.
        java.lang.IndexOutOfBoundsException - If the index is in error.
        java.lang.IllegalStateException - If the container is read-only.
      • setItem

        default ITEM setItem​(ITEM item,
                             int index)
        Sets an item at specified index.
        Parameters:
        item - The item to add.
        index - The index to insert the item before (-1 for last).
        Returns:
        The old item.
        Throws:
        java.lang.NullPointerException - If the item is null.
        java.lang.IndexOutOfBoundsException - If the index is in error.
        java.lang.IllegalStateException - If the container is read-only.
      • removeItem

        default ITEM removeItem​(int index)
        Removes an item.
        Parameters:
        index - The index of the item to delete.
        Returns:
        The item deleted.
        Throws:
        java.lang.IndexOutOfBoundsException - If the index is in error.
        java.lang.IllegalStateException - If the container is read-only.
      • removeItem

        default int removeItem​(ITEM item)
        Removes an item.
        Parameters:
        item - The item to remove.
        Returns:
        The index of the item removed, -1 if not found.
        Throws:
        java.lang.IndexOutOfBoundsException - If the index is in error.
        java.lang.IllegalStateException - If the container is read-only.
      • removeAllItems

        default void removeAllItems()
        Removes all items.
        Throws:
        java.lang.IllegalStateException - If the container is read-only.