diff --git a/README.md b/README.md index 8816fa6..e888077 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ API Documentations can be found [here](https://binhonglee.github.io/LibrarySyste 1. [Maven Apache](https://maven.apache.org/) 2. [Oracle JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) +3. [Kotlin](https://kotlinlang.org/) ## Use diff --git a/src/main/kotlin/libsys/UserFactory.kt b/src/main/kotlin/libsys/UserFactory.kt index d2c2c24..a5d402e 100644 --- a/src/main/kotlin/libsys/UserFactory.kt +++ b/src/main/kotlin/libsys/UserFactory.kt @@ -193,23 +193,28 @@ class UserFactory } } + /** + * Deletes the given User from the class (if found) + * @param user User to be deleted + * + * @return if User deletion is successful + */ fun deleteUser(user: User): Boolean { - try - { - return users.remove(user) - } - catch (e: Exception) - { - return false - } + return users.remove(user) } - fun deleteUser(i: Int): Boolean + /** + * Deletes the User with the given id from the class (if found) + * @param id id of the User to be deleted + * + * @return if User deletion is successful + */ + fun deleteUser(id: Int): Boolean { try { - return users.remove(getUser(i)) + return users.remove(getUser(id)) } catch (e: Exception) {