Class EnumSetTool


  • public class EnumSetTool
    extends java.lang.Object
    A couple of utility methods for handling EnumSet objects.
    • Constructor Summary

      Constructors 
      Constructor Description
      EnumSetTool()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <P extends java.lang.Enum<P>>
      java.util.EnumSet<P>
      except​(java.util.EnumSet<P> a, java.util.EnumSet<P> b)
      Return a new EnumSet as the difference of two supplied EnumSets.
      static <P extends java.lang.Enum<P>>
      java.util.EnumSet<P>
      intersect​(java.util.EnumSet<P> a, java.util.EnumSet<P> b)
      Return a new EnumSet as the intersection of two supplied EnumSets.
      static <P extends java.lang.Enum<P>>
      java.util.EnumSet<P>
      union​(java.util.EnumSet<P> a, java.util.EnumSet<P> b)
      Return a new EnumSet as the union of two supplied EnumSets.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EnumSetTool

        public EnumSetTool()
    • Method Detail

      • intersect

        public static <P extends java.lang.Enum<P>> java.util.EnumSet<P> intersect​(java.util.EnumSet<P> a,
                                                                                   java.util.EnumSet<P> b)
        Return a new EnumSet as the intersection of two supplied EnumSets. Neither is modified.
        Type Parameters:
        P - the Enum class common to both arguments
        Parameters:
        a - the first EnumSet
        b - the second EnumSet
        Returns:
        the combined EnumSet
      • union

        public static <P extends java.lang.Enum<P>> java.util.EnumSet<P> union​(java.util.EnumSet<P> a,
                                                                               java.util.EnumSet<P> b)
        Return a new EnumSet as the union of two supplied EnumSets. Neither is modified
        Type Parameters:
        P - the Enum class common to both arguments
        Parameters:
        a - the first EnumSet
        b - the second EnumSet
        Returns:
        the combined EnumSet
      • except

        public static <P extends java.lang.Enum<P>> java.util.EnumSet<P> except​(java.util.EnumSet<P> a,
                                                                                java.util.EnumSet<P> b)
        Return a new EnumSet as the difference of two supplied EnumSets. Neither is modified
        Type Parameters:
        P - the Enum class containing properties in (a) except those in (b)
        Parameters:
        a - the first EnumSet
        b - the second EnumSet
        Returns:
        the combined EnumSet