You can range random objects and add a value
You can obtain elements randomly using random classes as shown below.
Map<String, String> wordMapper = Map.of("school", "school", "book", "book", "class", "class");
Object[] keys = wordMapper.keySet();
String randomKey = keys[new Random().nextInt(keys.length)];
wordMapper.get(randomKey);
© 2024 OneMinuteCode. All rights reserved.