Class MapRandomizer<K,V>
- java.lang.Object
-
- org.jeasy.random.randomizers.collection.MapRandomizer<K,V>
-
- Type Parameters:
K- the type of keysV- the type of values
- All Implemented Interfaces:
Randomizer<java.util.Map<K,V>>
public class MapRandomizer<K,V> extends java.lang.Object implements Randomizer<java.util.Map<K,V>>
ARandomizerthat generates aMapwith random entries.- Author:
- Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
-
-
Constructor Summary
Constructors Constructor Description MapRandomizer(Randomizer<K> keyRandomizer, Randomizer<V> valueRandomizer)Create a newMapRandomizerwith a random number of entries.MapRandomizer(Randomizer<K> keyRandomizer, Randomizer<V> valueRandomizer, int nbEntries)Create a newMapRandomizerwith a fixed number of entries.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Map<K,V>getRandomValue()Generate a random value for the given type.
-
-
-
Constructor Detail
-
MapRandomizer
public MapRandomizer(Randomizer<K> keyRandomizer, Randomizer<V> valueRandomizer)
Create a newMapRandomizerwith a random number of entries.- Parameters:
keyRandomizer- the randomizer for keysvalueRandomizer- the randomizer for values
-
MapRandomizer
public MapRandomizer(Randomizer<K> keyRandomizer, Randomizer<V> valueRandomizer, int nbEntries)
Create a newMapRandomizerwith a fixed number of entries.- Parameters:
keyRandomizer- the randomizer for keysvalueRandomizer- the randomizer for valuesnbEntries- the number of entries to generate
-
-
Method Detail
-
getRandomValue
public java.util.Map<K,V> getRandomValue()
Description copied from interface:RandomizerGenerate a random value for the given type.- Specified by:
getRandomValuein interfaceRandomizer<K>- Returns:
- a random value for the given type
-
-