org.assertj.core.util
Class Maps

java.lang.Object
  extended by org.assertj.core.util.Maps

public class Maps
extends Object

Utility methods related to maps.

Author:
Yvonne Wang, Alex Ruiz

Method Summary
static String format(Map<?,?> map)
          Returns the String standard representation of the given map, or null if the given map is null.
static String format(Representation p, Map<?,?> map)
          Returns the String representation of the given map, or null if the given map is null.
static boolean isNullOrEmpty(Map<?,?> map)
          Indicates whether the given Map is null or empty.
static
<K,V> ConcurrentMap<K,V>
newConcurrentHashMap()
          Returns a mutable ConcurrentMap that is empty.
static
<K,V> Map<K,V>
newHashMap()
          Returns a mutable HashMap that is empty.
static
<K,V> WeakHashMap<K,V>
newWeakHashMap()
          Returns a mutable WeakHashMap that is empty.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newHashMap

public static <K,V> Map<K,V> newHashMap()
Returns a mutable HashMap that is empty.

Returns:
the created HashMap.

newConcurrentHashMap

public static <K,V> ConcurrentMap<K,V> newConcurrentHashMap()
Returns a mutable ConcurrentMap that is empty.

Returns:
the created ConcurrentMap.

newWeakHashMap

public static <K,V> WeakHashMap<K,V> newWeakHashMap()
Returns a mutable WeakHashMap that is empty.

Returns:
the created WeakHashMap.

isNullOrEmpty

public static boolean isNullOrEmpty(Map<?,?> map)
Indicates whether the given Map is null or empty.

Parameters:
map - the map to check.
Returns:
true if the given Map is null or empty, otherwise false.

format

public static String format(Map<?,?> map)
Returns the String standard representation of the given map, or null if the given map is null.

Parameters:
map - the map to format.
Returns:
the String representation of the given map.

format

public static String format(Representation p,
                            Map<?,?> map)
Returns the String representation of the given map, or null if the given map is null.

Parameters:
map - the map to format.
Returns:
the String representation of the given map.


Copyright © 2013–2015 AssertJ. All rights reserved.