-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMap.java
More file actions
31 lines (28 loc) · 843 Bytes
/
Copy pathMap.java
File metadata and controls
31 lines (28 loc) · 843 Bytes
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
29
30
31
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author 500062053
*/
import java.util.*;
public class Map
{
public static void main(String[] args)
{
Random r=new Random();
String it[]={"A","B","C","D","E","F"};
// LinkedHashMap t=new LinkedHashMap();//It maintains the order of Insertion
HashMap t=new HashMap(); //It doesn't maintain the order of keys and insertion
//TreeMap t=new TreeMap(); //It maintains the order of keys
for(int i=0;i<5;i++)
{
int key=r.nextInt(100);
String ele=it[i];
t.put(key,ele);
}
System.out.println("Map:"+t);
}
}