From eb8b6eb3934031a7f57d85ce627d18189e83618c Mon Sep 17 00:00:00 2001 From: Acrobot Date: Fri, 1 Nov 2013 16:51:42 +0100 Subject: [PATCH] Add an isEmpty() to RowSet --- src/main/java/com/Acrobot/Breeze/Database/RowSet.java | 9 +++++++++ src/main/java/com/Acrobot/Breeze/Database/Table.java | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/Acrobot/Breeze/Database/RowSet.java b/src/main/java/com/Acrobot/Breeze/Database/RowSet.java index 215d403..217a1b3 100644 --- a/src/main/java/com/Acrobot/Breeze/Database/RowSet.java +++ b/src/main/java/com/Acrobot/Breeze/Database/RowSet.java @@ -36,4 +36,13 @@ public class RowSet { public int size() { return rowList.size(); } + + /** + * Returns if the RowSet is empty + * + * @return Is the RowSet empty? + */ + public boolean isEmpty() { + return size() == 0; + } } \ No newline at end of file diff --git a/src/main/java/com/Acrobot/Breeze/Database/Table.java b/src/main/java/com/Acrobot/Breeze/Database/Table.java index 47badd6..5e6c04b 100644 --- a/src/main/java/com/Acrobot/Breeze/Database/Table.java +++ b/src/main/java/com/Acrobot/Breeze/Database/Table.java @@ -84,7 +84,7 @@ public class Table { */ public Row getRow(String criteria) throws SQLException { RowSet rs = select(criteria); - return (rs.size() > 0 ? rs.get(0) : new Row()); + return (!rs.isEmpty() ? rs.get(0) : new Row()); } /**