Class LongSet

All Implemented Interfaces:
Serializable, Cloneable, Iterable<Long>, Collection<Long>, Iterator, NavigableSet<Long>, SequencedCollection<Long>, SequencedSet<Long>, Set<Long>, SortedSet<Long>

public class LongSet extends TreeSet<Long> implements Iterator
This class extends TreeSet and implements a navigable set of Long elements.
See Also:
  • Constructor Details

    • LongSet

      public LongSet(Comparator<Long> c)
    • LongSet

      public LongSet(Long... ll)
      Creates a new LongSet and fills it with the Long values passed as parameters. The LongSet is sorted according to the natural ordering of its elements.
      Parameters:
      ll - A variable number of Long values that will fill the LongSet
    • LongSet

      public LongSet(Collection<Long> c)
      Creates a new LongSet and fills it with all the elements of the Collection passed as parameter; the elements in the collection must be of type Long. The LongSet is sorted according to the natural ordering of its elements.
      Parameters:
      c - The Collection of Long values that will fill the LongSet
    • LongSet

      public LongSet()
      Creates a new empty LongSet, sorted according to the natural ordering of its elements.
    • LongSet

      public LongSet(String s)
      Creates a new LongSet starting from the values contained in the string. Each value must be separated from the next by the comma (,). It is possible to indicate ranges of values by separating the start and end of the range using the minus character (-); the values between the beginning and the end of the range will all be included in the LongSet.
      The LongSet is sorted according to the natural ordering of its elements.
      Parameters:
      s - The string that contains the values that will fill the LongSet
    • LongSet

      public LongSet(String s, char delim, char rangedelim)
      Creates a new LongSet starting from the values contained in the string. Each value must be separated from the next by the delimiter character passed as second parameter. It is possible to indicate ranges of values by separating the start and end of the range using the range delimiter character passed as last parameter; the values between the beginning and the end of the range will all be included in the LongSet.
      The LongSet is sorted according to the natural ordering of its elements.
      Parameters:
      s - The string that contains the values that will fill the LongSet
      delim - The character that defines the values separator
      rangedelim - The character that defines the range separator
  • Method Details

    • toString

      public String toString()
      Returns the string version of the LongSet, i.e. a string in which every value is separated from the next by the comma (,) character.
      Overrides:
      toString in class AbstractCollection<Long>
      Returns:
      The string that represents the LongSet
    • toString

      public String toString(char delim)
      Returns the string version of the LongSet, i.e. a string in which every value is separated from the next by the delimiter character passed as parameter
      Parameters:
      delim - The character used to separate each value
      Returns:
      The string that represents the LongSet
    • scanNext

      protected void scanNext()
    • intervalsIterator

      public Iterator intervalsIterator()
      Returns an Iterator over the intervals (ranges) defined for the LongSet
      Returns:
      The Iterator in which every element is a values interval
    • hasNext

      public boolean hasNext()
      Checks if the intervals Iterator (see intervalsIterator()) has a next elements
      Specified by:
      hasNext in interface Iterator
      Returns:
      true if the Iterator has at least another element, false otherwise
    • next

      public LongSet next()
      Returns the next element of the intervals Iterator (see intervalsIterator())
      Specified by:
      next in interface Iterator
      Returns:
      The LongSet that is the next element in the iteration
    • remove

      public void remove()
      Empty method
      Specified by:
      remove in interface Iterator
    • toIntervalsString

      public String toIntervalsString()
      Returns a string version of the LongSet in which the values are expressed in range form. Each range is indicated by the initial and the final value, separated by the minus sign (-), and each range is separated by the next one with the comma (,).
      Returns:
      The string that represents the range version of the LongSet values
    • toIntervalsString

      public String toIntervalsString(char delim, char rangedelim)
      Returns a string version of the LongSet in which the values are expressed in range form. Each range is indicated by the initial and the final value, separated by the range delimiter character passed as second parameter. Each range is separated by the next one with the delimiter character, passed es first parameter.
      Parameters:
      delim - The character used to separate each range
      rangedelim - The character that defines the range separator
      Returns:
      The string that represents the range version of the LongSet values
    • createLongSet

      @Deprecated public static LongSet createLongSet(DBView dbv, String field)
      Deprecated.
      Use DBView.getLongSet(java.lang.String)
      Creates a LongSet and fills it with the values extracted from the column of the DBView
      Parameters:
      dbv - The DBView from which extract the values
      field - The column name
      Returns:
      A new LongSet filled with the extracted values