Class Dummies

java.lang.Object
net.apartium.cocoabeans.collect.Dummies

public class Dummies extends Object
A utility class providing "dummy" implementations of java collection api classes. The provided objects are guaranteed to always remain empty. If a piece of code attempts to alter the state of the object, nothing will happen, this is in contrast to java's own Collections.emptyMap() or Collections.emptySet(), which will throw an exception when something attempts to modify it. It is useful for shimming and rigging external code without causing too much trouble.
  • Constructor Details

    • Dummies

      public Dummies()
  • Method Details

    • dummyMap

      public static <K, V> Map<K,V> dummyMap()
      Returns the dummy map instance.
      Type Parameters:
      K - map key type
      V - map value type
      Returns:
      the dummy map instance.
    • dummySet

      public static <E> Set<E> dummySet()
      Returns the dummy set instance
      Type Parameters:
      E - element type
      Returns:
      the dummy set instance
    • dummyList

      public static <E> List<E> dummyList()
      Returns the dummy list instance
      Type Parameters:
      E - element type
      Returns:
      the dummy list instance
    • dummyCollection

      public static <E> Collection<E> dummyCollection()
      Returns the dummy collection instance
      Type Parameters:
      E - element type
      Returns:
      the dummy collection instance