Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- Map<Integer, Integer> balls = new TreeMap<>((o1, o2) -> {
- if (o1 % 2 == 1) {
- return 1;
- }
- if (o1 % 2 != 1) {
- return -1;
- }
- return 0;
- });
- for (int i = 0; i < 20; i++) {
- balls.put(i + 1, (int) (20 + Math.random() * 40));
- }
- System.out.println(balls.toString());
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement