FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/MapSort/src/com/hmkcode/Test.java at master · YueIan/Java · GitHub
YueIan
Java
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
Java
/
MapSort
/
src
/
com
/
hmkcode
/
Test.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
28 lines (19 loc) · 621 Bytes
Breadcrumbs
Java
/
MapSort
/
src
/
com
/
hmkcode
/
Test.java
Copy path
File metadata and controls
28 lines (19 loc) · 621 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.hmkcode;
import java.util.HashMap;
import java.util.Map;
public class Test {
public static void main(String[] args){
Map map = new HashMap();
//*value Class should implements the Comparable interface
//*String implements Comparable by default.
map.put("Z", "3");
map.put("D", "4");
map.put("A", "1");
map.put("B", "2");
map.put("F", "6");
map.put("E", "5");
System.out.println("Unsorted Map: "+map);
System.out.println("Sorted Map By Values: "+MapSort.sortByValue(map));
System.out.println("Sorted Map By Keys: "+MapSort.sortByKey(map));
}
}
Back
|
FazBrowse Home
|
New Git URL