GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Test.java · BlueSkyXin/Java-1@e678d64

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • MapSort/src/com/hmkcode
    • Test.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎MapSort/src/com/hmkcode/Test.java‎

Copy file name to clipboard
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.hmkcode;
2+
3+
4+
import java.util.HashMap;
5+
import java.util.Map;
6+
7+
public class Test {
8+
public static void main(String[] args){
9+
10+
11+
Map map = new HashMap();
12+
13+
//*value Class should implements the Comparable interface
14+
//*String implements Comparable by default.
15+
16+
map.put("Z", "3");
17+
map.put("D", "4");
18+
map.put("A", "1");
19+
map.put("B", "2");
20+
map.put("F", "6");
21+
map.put("E", "5");
22+
23+
System.out.println("Unsorted Map: "+map);
24+
System.out.println("Sorted Map By Values: "+MapSort.sortByValue(map));
25+
System.out.println("Sorted Map By Keys: "+MapSort.sortByKey(map));
26+
27+
}
28+
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.