Class HashSetFactory

java.lang.Object
com.ibm.wala.util.collections.HashSetFactory

public class HashSetFactory extends Object
A debugging aid. When HashSetFactory.DEBUG is set, this class creates ParanoidHashSets. Otherwise, it returns LinkedHashSets
  • Field Details

    • DEBUG

      public static final boolean DEBUG
      If true, this factory returns Paranoid versions of collections
      See Also:
  • Constructor Details

    • HashSetFactory

      public HashSetFactory()
  • Method Details

    • make

      public static <T> HashSet<T> make(int size)
      Returns:
      A ParanoidHashSet if DEBUG = true, a java.util.HashSet otherwise
    • make

      public static <T> HashSet<T> make()
      Returns:
      A ParanoidHashSet if DEBUG = true, a java.util.HashSet otherwise
    • make

      public static <T> HashSet<T> make(Collection<? extends T> s)
      Returns:
      A ParanoidHashSet if DEBUG = true, a java.util.HashSet otherwise
    • of

      @SafeVarargs public static <T, U extends T> HashSet<T> of(U... elements)
      Returns:
      A ParanoidHashSet if DEBUG is true, a HashSet otherwise
      See Also:
    • toSet

      @NotNull public static <T> @NotNull Collector<T,?,Set<T>> toSet()
      Returns a Collector that accumulates the input elements into a new HashSet as provided by make().
      Type Parameters:
      T - the type of the input elements
      Returns:
      a Collector that collects all the input elements into a HashSet