Class RegularContiguousSet<C extends java.lang.Comparable>

  • All Implemented Interfaces:
    SortedIterable<C>, java.io.Serializable, java.lang.Iterable<C>, java.util.Collection<C>, java.util.NavigableSet<C>, java.util.Set<C>, java.util.SortedSet<C>

    final class RegularContiguousSet<C extends java.lang.Comparable>
    extends ContiguousSet<C>
    An implementation of ContiguousSet that contains one or more elements.
    • Field Detail

      • range

        private final Range<C extends java.lang.Comparable> range
    • Method Detail

      • intersectionInCurrentDomain

        private ContiguousSet<C> intersectionInCurrentDomain​(Range<C> other)
      • subSetImpl

        ContiguousSet<C> subSetImpl​(C fromElement,
                                    boolean fromInclusive,
                                    C toElement,
                                    boolean toInclusive)
        Specified by:
        subSetImpl in class ContiguousSet<C extends java.lang.Comparable>
      • indexOf

        int indexOf​(java.lang.Object target)
        Description copied from class: ImmutableSortedSet
        Returns the position of an element within the set, or -1 if not present.
        Specified by:
        indexOf in class ImmutableSortedSet<C extends java.lang.Comparable>
      • iterator

        public UnmodifiableIterator<C> iterator()
        Description copied from class: ImmutableCollection
        Returns an unmodifiable iterator across the elements in this collection.
        Specified by:
        iterator in interface java.util.Collection<C extends java.lang.Comparable>
        Specified by:
        iterator in interface java.lang.Iterable<C extends java.lang.Comparable>
        Specified by:
        iterator in interface java.util.NavigableSet<C extends java.lang.Comparable>
        Specified by:
        iterator in interface java.util.Set<C extends java.lang.Comparable>
        Specified by:
        iterator in interface SortedIterable<C extends java.lang.Comparable>
        Specified by:
        iterator in class ImmutableSortedSet<C extends java.lang.Comparable>
      • equalsOrThrow

        private static boolean equalsOrThrow​(java.lang.Comparable<?> left,
                                             java.lang.Comparable<?> right)
      • isPartialView

        boolean isPartialView()
        Description copied from class: ImmutableCollection
        Returns true if this immutable collection's implementation contains references to user-created objects that aren't accessible via this collection's methods. This is generally used to determine whether copyOf implementations should make an explicit copy to avoid memory leaks.
        Specified by:
        isPartialView in class ImmutableCollection<C extends java.lang.Comparable>
      • first

        public C first()
        Specified by:
        first in interface java.util.SortedSet<C extends java.lang.Comparable>
        Overrides:
        first in class ImmutableSortedSet<C extends java.lang.Comparable>
      • last

        public C last()
        Specified by:
        last in interface java.util.SortedSet<C extends java.lang.Comparable>
        Overrides:
        last in class ImmutableSortedSet<C extends java.lang.Comparable>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<C extends java.lang.Comparable>
        Specified by:
        size in interface java.util.Set<C extends java.lang.Comparable>
        Specified by:
        size in class java.util.AbstractCollection<C extends java.lang.Comparable>
      • contains

        public boolean contains​(java.lang.Object object)
        Specified by:
        contains in interface java.util.Collection<C extends java.lang.Comparable>
        Specified by:
        contains in interface java.util.Set<C extends java.lang.Comparable>
        Specified by:
        contains in class ImmutableCollection<C extends java.lang.Comparable>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> targets)
        Specified by:
        containsAll in interface java.util.Collection<C extends java.lang.Comparable>
        Specified by:
        containsAll in interface java.util.Set<C extends java.lang.Comparable>
        Overrides:
        containsAll in class java.util.AbstractCollection<C extends java.lang.Comparable>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<C extends java.lang.Comparable>
        Specified by:
        isEmpty in interface java.util.Set<C extends java.lang.Comparable>
        Overrides:
        isEmpty in class java.util.AbstractCollection<C extends java.lang.Comparable>
      • range

        public Range<C> range()
        Description copied from class: ContiguousSet
        Returns a range, closed on both ends, whose endpoints are the minimum and maximum values contained in this set. This is equivalent to range(CLOSED, CLOSED).
        Specified by:
        range in class ContiguousSet<C extends java.lang.Comparable>
      • range

        public Range<C> range​(BoundType lowerBoundType,
                              BoundType upperBoundType)
        Description copied from class: ContiguousSet
        Returns the minimal range with the given boundary types for which all values in this set are contained within the range.

        Note that this method will return ranges with unbounded endpoints if BoundType.OPEN is requested for a domain minimum or maximum. For example, if set was created from the range [1..Integer.MAX_VALUE] then set.range(CLOSED, OPEN) must return [1..∞).

        Specified by:
        range in class ContiguousSet<C extends java.lang.Comparable>
      • equals

        public boolean equals​(java.lang.Object object)
        Specified by:
        equals in interface java.util.Collection<C extends java.lang.Comparable>
        Specified by:
        equals in interface java.util.Set<C extends java.lang.Comparable>
        Overrides:
        equals in class ImmutableSet<C extends java.lang.Comparable>
      • hashCode

        public int hashCode()
        Specified by:
        hashCode in interface java.util.Collection<C extends java.lang.Comparable>
        Specified by:
        hashCode in interface java.util.Set<C extends java.lang.Comparable>
        Overrides:
        hashCode in class ImmutableSet<C extends java.lang.Comparable>