aboutsummaryrefslogtreecommitdiffstats
path: root/compatibility-client/src
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-10-12 10:46:06 +0200
committerHenri Sara <henri.sara@gmail.com>2017-10-12 11:46:06 +0300
commitc147b5d85bca3ddf30d9adbcd268066165889f37 (patch)
tree18d73bda278618004ec4a28ee62af7eb7edbeb98 /compatibility-client/src
parent13d406a7086cc1546eac3fa86f6263bfb436de85 (diff)
downloadvaadin-framework-c147b5d85bca3ddf30d9adbcd268066165889f37.tar.gz
vaadin-framework-c147b5d85bca3ddf30d9adbcd268066165889f37.zip
Use Collection.isEmpty() (#10172)
Diffstat (limited to 'compatibility-client/src')
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java6
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java2
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java7
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/ui/table/TableConnector.java2
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/datasources/ListSorter.java5
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionModelMulti.java6
-rw-r--r--compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java2
7 files changed, 15 insertions, 15 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java
index b825cec550..940240a773 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VFilterSelect.java
@@ -1069,7 +1069,7 @@ public class VFilterSelect extends Composite
* Gets the preferred height of the menu including pageItemsCount items.
*/
String getPreferredHeight(int pageItemsCount) {
- if (currentSuggestions.size() > 0) {
+ if (!currentSuggestions.isEmpty()) {
final int pixels = (getPreferredHeight()
/ currentSuggestions.size()) * pageItemsCount;
return pixels + "px";
@@ -1298,7 +1298,7 @@ public class VFilterSelect extends Composite
*/
int getItemOffsetHeight() {
List<MenuItem> items = getItems();
- return items != null && items.size() > 0
+ return items != null && !items.isEmpty()
? items.get(0).getOffsetHeight()
: 0;
}
@@ -1308,7 +1308,7 @@ public class VFilterSelect extends Composite
*/
int getItemOffsetWidth() {
List<MenuItem> items = getItems();
- return items != null && items.size() > 0
+ return items != null && !items.isEmpty()
? items.get(0).getOffsetWidth()
: 0;
}
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java
index ce97348589..12738541aa 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VScrollTable.java
@@ -1312,7 +1312,7 @@ public class VScrollTable extends FlowPanel
// that is the same as the previous selection. This prevents
// unwanted scrolling (#18247).
boolean rowsUnSelected = removeUnselectedRowKeys(selectedKeys);
- boolean updateFocus = rowsUnSelected || selectedRowKeys.size() == 0
+ boolean updateFocus = rowsUnSelected || selectedRowKeys.isEmpty()
|| focusedRow == null;
if (scrollBody != null) {
for (Widget w : scrollBody) {
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java
index 81d71e809a..38c2f40c7c 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/VTree.java
@@ -459,7 +459,7 @@ public class VTree extends FocusElementPanel
public void setSelected(TreeNode treeNode, boolean selected) {
if (selected) {
if (!isMultiselect) {
- while (selectedIds.size() > 0) {
+ while (!selectedIds.isEmpty()) {
final String id = selectedIds.iterator().next();
final TreeNode oldSelection = getNodeByKey(id);
if (oldSelection != null) {
@@ -1725,7 +1725,7 @@ public class VTree extends FocusElementPanel
TreeNode node = null;
// If node is open and has children then move in to the children
if (!focusedNode.isLeaf() && focusedNode.getState()
- && focusedNode.getChildren().size() > 0) {
+ && !focusedNode.getChildren().isEmpty()) {
node = focusedNode.getChildren().get(0);
} else {
// Move down to the next sibling
@@ -1906,8 +1906,7 @@ public class VTree extends FocusElementPanel
* @return The bottom most child
*/
private TreeNode getLastVisibleChildInTree(TreeNode root) {
- if (root.isLeaf() || !root.getState()
- || root.getChildren().size() == 0) {
+ if (root.isLeaf() || !root.getState() || root.getChildren().isEmpty()) {
return root;
}
List<TreeNode> children = root.getChildren();
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/table/TableConnector.java b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/table/TableConnector.java
index b4a00559b1..2fc55c7f58 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/ui/table/TableConnector.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/ui/table/TableConnector.java
@@ -334,7 +334,7 @@ public class TableConnector extends AbstractFieldConnector
// in selection and exists with same index
getWidget().setRowFocus(getWidget().getRenderedRowByKey(
getWidget().focusedRow.getKey()));
- } else if (getWidget().selectedRowKeys.size() > 0) {
+ } else if (!getWidget().selectedRowKeys.isEmpty()) {
// try to focus any row in selection
getWidget().setRowFocus(getWidget().getRenderedRowByKey(
getWidget().selectedRowKeys.iterator().next()));
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/datasources/ListSorter.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/datasources/ListSorter.java
index 24d1eec06c..22bc9e7508 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/datasources/ListSorter.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/datasources/ListSorter.java
@@ -159,11 +159,12 @@ public class ListSorter<T> {
if (result != 0) {
return o.getDirection() == SortDirection.ASCENDING
- ? result : -result;
+ ? result
+ : -result;
}
}
- if (order.size() > 0) {
+ if (!order.isEmpty()) {
return order.get(0)
.getDirection() == SortDirection.ASCENDING
? a.hashCode() - b.hashCode()
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionModelMulti.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionModelMulti.java
index 9751b0909f..4b6ce1ad58 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionModelMulti.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widget/grid/selection/SelectionModelMulti.java
@@ -104,7 +104,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T>
@Override
public boolean deselectAll() {
- if (selectedRows.size() > 0) {
+ if (!selectedRows.isEmpty()) {
@SuppressWarnings("unchecked")
final LinkedHashSet<RowHandle<T>> selectedRowsClone = (LinkedHashSet<RowHandle<T>>) selectedRows
@@ -140,7 +140,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T>
}
}
- if (added.size() > 0) {
+ if (!added.isEmpty()) {
grid.fireEvent(new SelectionEvent<T>(grid, added, null,
isBeingBatchSelected()));
@@ -164,7 +164,7 @@ public class SelectionModelMulti<T> extends AbstractRowHandleSelectionModel<T>
}
}
- if (removed.size() > 0) {
+ if (!removed.isEmpty()) {
grid.fireEvent(new SelectionEvent<T>(grid, null, removed,
isBeingBatchSelected()));
return true;
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java
index 65ab2b4a71..c44f08ecc9 100644
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java
+++ b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Escalator.java
@@ -421,7 +421,7 @@ public class Escalator extends Widget
velocity = delta / ellapsed;
// if last speed was so low, reset speeds and start
// storing again
- if (speeds.size() > 0 && !validSpeed(speeds.get(0))) {
+ if (!speeds.isEmpty() && !validSpeed(speeds.get(0))) {
speeds.clear();
run = true;
}