Tal Nisan has uploaded a new change for review.

Change subject: frontend: Remove IteratorUtils class
......................................................................

frontend: Remove IteratorUtils class

Removed the IteratorUtils class which only contained one helper method
not that helpfull which was only used in one class, instead the method
was moved to the using class

Change-Id: If3d3669cd7d5ee0d127ca66ae3fff6b36986d601
Signed-off-by: Tal Nisan <[email protected]>
---
M 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java
D 
frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/IteratorUtils.java
2 files changed, 14 insertions(+), 34 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/87/14487/1

diff --git 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java
 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java
index 3a88f4a..b283230 100644
--- 
a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java
+++ 
b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/SearchableListModel.java
@@ -33,7 +33,6 @@
 import org.ovirt.engine.ui.uicommonweb.models.reports.ReportModel;
 import org.ovirt.engine.ui.uicompat.Event;
 import org.ovirt.engine.ui.uicompat.EventArgs;
-import org.ovirt.engine.ui.uicompat.IteratorUtils;
 import org.ovirt.engine.ui.uicompat.NotifyCollectionChangedEventArgs;
 import org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs;
 
@@ -636,15 +635,15 @@
     protected boolean getNextSearchPageAllowed()
     {
         if (!getSearchNextPageCommand().getIsAvailable() || getItems() == null
-                || IteratorUtils.moveNext(getItems().iterator()) == false)
+                || moveNext(getItems().iterator()) == false)
         {
             return false;
         }
 
         boolean retValue = true;
 
-        // ** TODO: Inefficient performance-wise! If 'Items' was ICollection 
or IList
-        // ** it would be better, since we could simply check its 'Count' 
property.
+        // ** TODO: Inefficient performance-wise! If 'items' was of type 
Collection or List
+        // ** it would be better, since we could simply check its 'size' 
property.
 
         int pageSize = getSearchPageSize();
 
@@ -652,7 +651,7 @@
         {
             Iterator e = getItems().iterator();
             int itemsCountInCurrentPage = 0;
-            while (IteratorUtils.moveNext(e))
+            while (moveNext(e))
             {
                 itemsCountInCurrentPage++;
             }
@@ -927,4 +926,14 @@
         return getListName();
     }
 
+    @SuppressWarnings("rawtypes")
+    private static boolean moveNext(Iterator iterator) {
+        if (iterator.hasNext()) {
+            iterator.next();
+            return true;
+        }
+        else {
+            return false;
+        }
+    }
 }
diff --git 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/IteratorUtils.java
 
b/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/IteratorUtils.java
deleted file mode 100644
index c68b3a6..0000000
--- 
a/frontend/webadmin/modules/uicompat/src/main/java/org/ovirt/engine/ui/uicompat/IteratorUtils.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.ovirt.engine.ui.uicompat;
-
-import java.util.Iterator;
-
-public class IteratorUtils {
-
-       /// <summary>
-
-       /// Advances to the next item in the specified enumerator and returns 
true.
-
-       /// If no item has left to advance to - return false
-
-       /// </summary>
-
-       /// <param name="enumerator">specified enumerator</param>
-
-       /// <returns>true if advanced to next item, false otherwise</returns>
-
-       @SuppressWarnings("rawtypes")
-       public static boolean moveNext(Iterator iterator) {
-               if (iterator.hasNext()) {
-                       iterator.next();
-                       return true;
-               }
-               else {
-                       return false;
-               }
-       }
-}


--
To view, visit http://gerrit.ovirt.org/14487
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If3d3669cd7d5ee0d127ca66ae3fff6b36986d601
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tal Nisan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to