Class GridListSet<V>

    • Constructor Detail

      • GridListSet

        public GridListSet()
        Creates unsorted list set. Values will be ordered in insertion order.
      • GridListSet

        public GridListSet​(@Nullable
                           @Nullable Comparator<V> comp)
        If comparator is not null, then sorted list set will be created. Values will be sorted according to provided comparator.
        Parameters:
        comp - Optional comparator to sort values.
      • GridListSet

        public GridListSet​(@Nullable
                           @Nullable Comparator<V> comp,
                           boolean strict)
        If comparator is not null, then sorted list set will be created. Values will be sorted according to provided comparator.
        Parameters:
        comp - Optional comparator to sort values.
        strict - Strict flag.
      • GridListSet

        public GridListSet​(GridListSet<V> copy)
        Copy constructor.
        Parameters:
        copy - Set to copy from.
    • Method Detail

      • strict

        public boolean strict()
        Gets value of strict flag for this set.
        Returns:
        Value of strict flag for this set.
      • comparator

        @Nullable
        public @Nullable Comparator<V> comparator()
        Gets optional comparator for this set.
        Returns:
        Optional comparator for this set.
      • addx

        @Nullable
        public V addx​(V val)
        Either adds a value to set or does nothing if value is already present.
        Parameters:
        val - Value to add.
        Returns:
        The instance of value from this set or null if value was added.
      • removeFirst

        @Nullable
        public V removeFirst()
        Removes the first element of this list.
        Returns:
        Removed element or null if list is empty.
      • removeLast

        @Nullable
        public V removeLast()
        Removes the last element of this list.
        Returns:
        Removed element or null if list is empty.
      • first

        @Nullable
        public V first()
        Gets first element of this list.
        Returns:
        First element or null if list is empty.
      • last

        @Nullable
        public V last()
        Gets last element of this list.
        Returns:
        Last element or null if list is empty.
      • removex

        @Nullable
        public V removex​(V val)
        Removes given value from the set and returns the instance stored in the set or null if value was not found.
        Parameters:
        val - Value to remove.
        Returns:
        The instance that was stored in the set or null.
      • get

        @Nullable
        public V get​(V val)
        Gets instance e stored in this set for which e.equals(val) returns true.
        Parameters:
        val - Value to check for equality.
        Returns:
        Instance stored in this set for which e.equals(val) returns true.
      • get

        public V get​(int idx)
        Gets value at given index within internal list. Note that this method will iterate through the list to get a value at the specified index.
        Parameters:
        idx - Index to get value at (must be non-negative and less than size()).
        Returns:
        Value at give index.
      • copy

        public GridListSet<V> copy()
        Creates a copy of this set.
        Returns:
        Copy of this set.
      • values

        public List<V> values()
        Gets a copy of the internal list.
        Returns:
        Copy of the internal list.
      • toSynchronized

        public GridListSet<V> toSynchronized()
        Creates a synchronized instance of this set.
        Returns:
        Synchronized instance of this set.