Can't store Object in HashMap

I'm trying to create a SecureDataContainer with HashMap so defined:

HashMap: ()>

Where KeyCouple is a class defined by me which contains the couple to access to the Vector associated to that couple.

Now when i create a couple of HashMap in this method

private Map> DBUsers;

public void createUser(String Id, String passw) throws

UserAlreadyPresent {

if(Id.isEmpty() || passw.isEmpty()) throw new IllegalArgumentException();

if(existsUser(Id)) throw new UserAlreadyPresent(Id);

KeyCouple u = new KeyCouple(Id, passw);

DBUsers.put(u, new Vector<>());

}

Now, in main class, I Run the following code:

private static void testContainer(SecureDataContainer container){

try {

container.createUser("Name","Pwd");

} catch (UserAlreadyPresent e) {

System.out.println("User already present");

}

...

To create the user "Name" with...

Read More »

By: StackOverFlow - Thursday, 8 November

Related Posts