@@ -7,7 +7,7 @@ import java.util.*;
class UserFactory
class UserFactory
{
{
private List<User> users = new List<User>;
private List<User> users = new Array List<User>() ;
private int id;
private int id;
public UserFactory()
public UserFactory()
@@ -15,7 +15,7 @@ class UserFactory
id = 0;
id = 0;
}
}
public User newUser(String name; int limit)
public User newUser(String name, int limit)
{
{
User temp = new User(name, id, limit);
User temp = new User(name, id, limit);
users.add(temp);
users.add(temp);
@@ -55,15 +55,15 @@ class UserFactory
throw new NullPointerException();
throw new NullPointerException();
}
}
public void update(User old, User new)
public void update(User oldUser , User newUser )
{
{
for (int i = 0; i < users.size(); i++)
for (int i = 0; i < users.size(); i++)
{
{
User temp = users.get(i);
User temp = users.get(i);
if(temp.getId() == old.getId())
if(temp.getId() == oldUser .getId())
{
{
users.set(i, new);
users.set(i, newUser );
}
}
}
}
}
}