Ver código fonte

update() for BookFactory

- Added update(Book) on BookFactory.java
master
BinHong Lee 8 anos atrás
pai
commit
5b6742ce71
2 arquivos alterados com 15 adições e 2 exclusões
  1. +14
    -1
      BookFactory.java
  2. +1
    -1
      UserFactory.java

+ 14
- 1
BookFactory.java Ver arquivo

@@ -1,6 +1,6 @@
/*
* Written by : Bin Hong Lee
* Last edited : 5/31/2016
* Last edited : 6/8/2016
*/

import java.util.*;
@@ -51,4 +51,17 @@ class BookFactory

throw new NullPointerException();
}

public void update(Book newBook)
{
for (int i = 0; i < books.size(); i++)
{
Book temp = books.get(i);

if(temp.getId() == newBook.getId())
{
books.set(i, newBook);
}
}
}
}

+ 1
- 1
UserFactory.java Ver arquivo

@@ -1,6 +1,6 @@
/*
* Written by : Bin Hong Lee
* Last edited : 6/6/2016
* Last edited : 6/7/2016
*/

import java.util.*;


Carregando…
Cancelar
Salvar