Class MapRandomizer<K,V>

java.lang.Object
org.jeasy.random.randomizers.collection.MapRandomizer<K,V>
Type Parameters:
K - the type of keys
V - the type of values
All Implemented Interfaces:
Randomizer<Map<K,V>>

public class MapRandomizer<K,V> extends Object implements Randomizer<Map<K,V>>
A Randomizer that generates a Map with random entries.
Author:
Mahmoud Ben Hassine ([email protected])
  • Constructor Details

    • MapRandomizer

      public MapRandomizer(Randomizer<K> keyRandomizer, Randomizer<V> valueRandomizer)
      Create a new MapRandomizer with a random number of entries.
      Parameters:
      keyRandomizer - the randomizer for keys
      valueRandomizer - the randomizer for values
    • MapRandomizer

      public MapRandomizer(Randomizer<K> keyRandomizer, Randomizer<V> valueRandomizer, int nbEntries)
      Create a new MapRandomizer with a fixed number of entries.
      Parameters:
      keyRandomizer - the randomizer for keys
      valueRandomizer - the randomizer for values
      nbEntries - the number of entries to generate
  • Method Details

    • getRandomValue

      public Map<K,V> getRandomValue()
      Description copied from interface: Randomizer
      Generate a random value for the given type.
      Specified by:
      getRandomValue in interface Randomizer<K>
      Returns:
      a random value for the given type