Module dagger

Class DaggerCollections


  • public final class DaggerCollections
    extends java.lang.Object
    Collection utility methods in service of Dagger internal classes. Do not use in client code.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean hasDuplicates​(java.util.List<?> list)
      Returns true if at least one pair of items in list are equals.
      static <K,​V>
      java.util.LinkedHashMap<K,​V>
      newLinkedHashMapWithExpectedSize​(int expectedSize)
      Creates a LinkedHashMap instance, with a high enough "initial capacity" that it should hold expectedSize elements without growth.
      static <T> java.util.List<T> presizedList​(int size)
      Returns a new list that is pre-sized to size, or Collections.emptyList() if empty.
      • Methods inherited from class java.lang.Object

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

      • presizedList

        public static <T> java.util.List<T> presizedList​(int size)
        Returns a new list that is pre-sized to size, or Collections.emptyList() if empty. The list returned is never intended to grow beyond size, so adding to a list when the size is 0 is an error.
      • hasDuplicates

        public static boolean hasDuplicates​(java.util.List<?> list)
        Returns true if at least one pair of items in list are equals.
      • newLinkedHashMapWithExpectedSize

        public static <K,​V> java.util.LinkedHashMap<K,​V> newLinkedHashMapWithExpectedSize​(int expectedSize)
        Creates a LinkedHashMap instance, with a high enough "initial capacity" that it should hold expectedSize elements without growth.