Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.internal.util.collections
Class CollectionHelper

    java.lang.Object
      org.hibernate.internal.util.collections.CollectionHelper

    public final class CollectionHelper

extends Object

Various help for handling collections.

Field Summary
`static Collection` | `EMPTY_COLLECTION`
`static List` | `EMPTY_LIST`
`static Map` | `EMPTY_MAP`
`static float` | `LOAD_FACTOR`
`static int` | `MINIMUM_INITIAL_CAPACITY`

Method Summary
`static
`<T> List<T>`
` | `arrayList(int anticipatedSize)`
`static
`<K,V> ConcurrentHashMap<K,V>`
` | `concurrentMap(int expectedNumberOfElements)` Create a properly sized `ConcurrentHashMap` based on the given expected number of elements.
`static
`<K,V> ConcurrentHashMap<K,V>`
` | `concurrentMap(int expectedNumberOfElements, float loadFactor)` Create a properly sized `ConcurrentHashMap` based on the given expected number of elements and an explicit load factor
`static int` | `determineProperSizing(int numberOfElements)` Determine the proper initial size for a new collection in order for it to hold the given a number of elements.
`static int` | `determineProperSizing(Map original)` Given a map, determine the proper initial size for a new Map to hold the same number of values.
`static int` | `determineProperSizing(Set original)` Given a set, determine the proper initial size for a new set to hold the same number of values.
`static boolean` | `isEmpty(Collection collection)`
`static boolean` | `isEmpty(Map map)`
`static boolean` | `isNotEmpty(Collection collection)`
`static boolean` | `isNotEmpty(Map map)`
`static
`<K,V> Map<K,V>`
` | `mapOfSize(int size)` Build a properly sized map, especially handling load size and load factor to prevent immediate resizing.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MINIMUM_INITIAL_CAPACITY

    public static final int MINIMUM_INITIAL_CAPACITY

See Also:
  Constant Field Values

### LOAD_FACTOR

    public static final float LOAD_FACTOR

See Also:
  Constant Field Values

### EMPTY_LIST

    public static final List EMPTY_LIST

### EMPTY_COLLECTION

    public static final Collection EMPTY_COLLECTION

### EMPTY_MAP

    public static final Map EMPTY_MAP

Method Detail

### mapOfSize

    public static <K,V> Map<K,V> mapOfSize(int size)

  Build a properly sized map, especially handling load size and load factor to prevent immediate resizing.

  Especially helpful for copy map contents.

  Parameters:
    `size` - The size to make the map.
  Returns:
    The sized map.

### determineProperSizing

    public static int determineProperSizing(Map original)

  Given a map, determine the proper initial size for a new Map to hold the same number of values. Specifically we want to account for load size and load factor to prevent immediate resizing.

  Parameters:
    `original` - The original map
  Returns:
    The proper size.

### determineProperSizing

    public static int determineProperSizing(Set original)

  Given a set, determine the proper initial size for a new set to hold the same number of values. Specifically we want to account for load size and load factor to prevent immediate resizing.

  Parameters:
    `original` - The original set
  Returns:
    The proper size.

### determineProperSizing

    public static int determineProperSizing(int numberOfElements)

  Determine the proper initial size for a new collection in order for it to hold the given a number of elements. Specifically we want to account for load size and load factor to prevent immediate resizing.

  Parameters:
    `numberOfElements` - The number of elements to be stored.
  Returns:
    The proper size.

### concurrentMap

    public static <K,V> ConcurrentHashMap<K,V> concurrentMap(int expectedNumberOfElements)

  Create a properly sized `ConcurrentHashMap` based on the given expected number of elements.

  Type Parameters:
    `K` - The map key type
    `V` - The map value type
  Parameters:
    `expectedNumberOfElements` - The expected number of elements for the created map
  Returns:
    The created map.

### concurrentMap

    public static <K,V> ConcurrentHashMap<K,V> concurrentMap(int expectedNumberOfElements,
                                                             float loadFactor)

  Create a properly sized `ConcurrentHashMap` based on the given expected number of elements and an explicit load factor

  Type Parameters:
    `K` - The map key type
    `V` - The map value type
  Parameters:
    `expectedNumberOfElements` - The expected number of elements for the created map
    `loadFactor` - The collection load factor
  Returns:
    The created map.

### arrayList

    public static <T> List<T> arrayList(int anticipatedSize)

### isEmpty

    public static boolean isEmpty(Collection collection)

### isEmpty

    public static boolean isEmpty(Map map)

### isNotEmpty

    public static boolean isNotEmpty(Collection collection)

### isNotEmpty

    public static boolean isNotEmpty(Map map)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.