Package org.apache.solr.common.util

# Class CollectionUtil

java.lang.Object
org.apache.solr.common.util.CollectionUtil

public final class CollectionUtil extends Object
Methods for creating collections with exact sizes, and other convenience methods

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

## Method Summary

Modifier and Type
Method
Description
`static boolean`
`isEmpty(Collection<?> collection)`
`static boolean`
`isEmpty(Map<?,?> map)`
`static boolean`
`isNotEmpty(Collection<?> collection)`
`static boolean`
`isNotEmpty(Map<?,?> map)`
`static <K, V> HashMap<K,V>`
`newHashMap(int size)`
Returns a new `HashMap` sized to contain `size` items without resizing the internal array.
`static <E> HashSet<E>`
`newHashSet(int size)`
Returns a new `HashSet` sized to contain `size` items without resizing the internal array.
`static <K, V> LinkedHashMap<K,V>`
`newLinkedHashMap(int size)`
Returns a new `LinkedHashMap` sized to contain `size` items without resizing the internal array.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Method Details

### newHashMap

public static <K, V> HashMap<K,V> newHashMap(int size)
Returns a new `HashMap` sized to contain `size` items without resizing the internal array.

### newLinkedHashMap

public static <K, V> LinkedHashMap<K,V> newLinkedHashMap(int size)
Returns a new `LinkedHashMap` sized to contain `size` items without resizing the internal array.

### newHashSet

public static <E> HashSet<E> newHashSet(int size)
Returns a new `HashSet` sized to contain `size` items without resizing the internal array.

### isEmpty

public static boolean isEmpty(Collection<?> collection)

### isNotEmpty

public static boolean isNotEmpty(Collection<?> collection)

### isEmpty

public static boolean isEmpty(Map<?,?> map)

### isNotEmpty

public static boolean isNotEmpty(Map<?,?> map)