Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.List;
- import java.util.Map;
- import java.util.TreeMap;
- public class ShuffleMap {
- public static Map<Integer, String> map;
- public static String analysis;
- static {
- map = new TreeMap<>();
- map.put(0, "夢");
- map.put(1, "花");
- map.put(2, "亀");
- map.put(3, "猿");
- map.put(4, "女");
- map.put(5, "寝");
- map.put(6, "金");
- map.put(7, "性");
- map.put(8, "食");
- map.put(9, "飲");
- map.put(10, "太");
- }
- protected static void getAnalysis() {
- List<String> list = new ArrayList<>();
- list.addAll(map.values());
- Collections.shuffle(list);
- analysis = String.join(" ", list);
- }
- public static void main(String[] args) {
- System.out.println(map);
- getAnalysis();
- System.out.println(analysis);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement