summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitrii Rogozin <dmitrii@vaadin.com>2014-10-21 16:58:01 +0300
committerVaadin Code Review <review@vaadin.com>2014-10-22 12:42:27 +0000
commitb3d3ea133ef9ef80b037b0cfa5b5436319f58ee4 (patch)
treeb059c88312f5b736fceb937a958171b2ea0ea280
parentc6c3e3ad49eecceb445dd1b1da70db397fe9c10e (diff)
downloadvaadin-framework-b3d3ea133ef9ef80b037b0cfa5b5436319f58ee4.tar.gz
vaadin-framework-b3d3ea133ef9ef80b037b0cfa5b5436319f58ee4.zip
Refactor VaadinFinderLocatorStrategy
Change-Id: I9a3b3087f49f65e6ee0733fab42573d2b84c188e
-rw-r--r--client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java17
1 files changed, 4 insertions, 13 deletions
diff --git a/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java b/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java
index 7346e489e5..44bdeddff3 100644
--- a/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java
+++ b/client/src/com/vaadin/client/componentlocator/VaadinFinderLocatorStrategy.java
@@ -17,6 +17,7 @@ package com.vaadin.client.componentlocator;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.LinkedHashSet;
import java.util.List;
import com.google.gwt.dom.client.Document;
@@ -726,19 +727,9 @@ public class VaadinFinderLocatorStrategy implements LocatorStrategy {
*/
private final <T> List<T> eliminateDuplicates(List<T> list) {
- int l = list.size();
- for (int j = 0; j < l; ++j) {
- T ref = list.get(j);
-
- for (int i = j + 1; i < l; ++i) {
- if (list.get(i) == ref) {
- list.remove(i);
- --i;
- --l;
- }
- }
- }
-
+ LinkedHashSet<T> set = new LinkedHashSet<T>(list);
+ list.clear();
+ list.addAll(set);
return list;
}