Sfoglia il codice sorgente

update() for BookFactory

- Added update(Book) on BookFactory.java
master
BinHong Lee 8 anni fa
parent
commit
5b6742ce71
2 ha cambiato i file con 15 aggiunte e 2 eliminazioni
  1. +14
    -1
      BookFactory.java
  2. +1
    -1
      UserFactory.java

+ 14
- 1
BookFactory.java Vedi File

@@ -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 Vedi File

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

import java.util.*;


Caricamento…
Annulla
Salva