Class EnumSetTool


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

      • EnumSetTool

        public EnumSetTool()
    • Method Detail

      • intersect

        public static <P extends Enum<P>> EnumSet<P> intersect​(EnumSet<P> a,
                                                               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 Enum<P>> EnumSet<P> union​(EnumSet<P> a,
                                                           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 Enum<P>> EnumSet<P> except​(EnumSet<P> a,
                                                            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