-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIDandPasswords.java
30 lines (26 loc) · 989 Bytes
/
IDandPasswords.java
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
import java.util.HashMap;
/**
* This class is used to store login information for a hypothetical program.
* It has a HashMap field that stores the login information. The HashMap has
* usernames as keys and passwords as values. The constructor initializes the
* HashMap with some sample login information. The getLogininfo method returns
* a copy of the HashMap.
*/
public class IDandPasswords {
private HashMap<String, String> logininfo = new HashMap<>();
/**
* Constructor that initializes the HashMap with some sample login information.
*/
public IDandPasswords() {
logininfo.put("username", "password");
logininfo.put("username2", "password2");
logininfo.put("username3", "password3");
logininfo.put("username4", "password4");
}
/**
* Returns a copy of the HashMap that stores the login information.
*/
public HashMap<String, String> getLogininfo() {
return new HashMap<>(logininfo);
}
}