Class NameSet


  • public class NameSet
    extends java.lang.Object
    Set of names that can be accessed with and without case sensitivity.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.util.Comparator<java.lang.String> COMPARATOR  
      private static java.lang.Object DUMMY  
      private NameMap<java.lang.Object> names  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        NameSet()
      Creates a NameSet, initially empty.
      private NameSet​(NameMap<java.lang.Object> names)
      Creates a NameSet based on an existing set.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(java.lang.String name)  
      boolean contains​(java.lang.String name, boolean caseSensitive)
      Returns whether this set contains the given name, with a given case-sensitivity.
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      static NameSet immutableCopyOf​(java.util.Set<java.lang.String> names)
      Creates a NameSet that is an immutable copy of a given collection.
      java.lang.Iterable<java.lang.String> iterable()
      Returns the contents as an iterable.
      java.util.Collection<java.lang.String> range​(java.lang.String name, boolean caseSensitive)
      Returns an iterable over all the entries in the set that match the given name.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • COMPARATOR

        public static final java.util.Comparator<java.lang.String> COMPARATOR
      • DUMMY

        private static final java.lang.Object DUMMY
      • names

        private final NameMap<java.lang.Object> names
    • Constructor Detail

      • NameSet

        private NameSet​(NameMap<java.lang.Object> names)
        Creates a NameSet based on an existing set.
      • NameSet

        public NameSet()
        Creates a NameSet, initially empty.
    • Method Detail

      • immutableCopyOf

        public static NameSet immutableCopyOf​(java.util.Set<java.lang.String> names)
        Creates a NameSet that is an immutable copy of a given collection.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • add

        public void add​(java.lang.String name)
      • range

        public java.util.Collection<java.lang.String> range​(java.lang.String name,
                                                            boolean caseSensitive)
        Returns an iterable over all the entries in the set that match the given name. If case-sensitive, that iterable will have 0 or 1 elements; if case-insensitive, it may have 0 or more.
      • contains

        public boolean contains​(java.lang.String name,
                                boolean caseSensitive)
        Returns whether this set contains the given name, with a given case-sensitivity.
      • iterable

        public java.lang.Iterable<java.lang.String> iterable()
        Returns the contents as an iterable.