From: Manolo Carrasco Date: Mon, 28 Feb 2011 21:52:09 +0000 (+0000) Subject: Remove redundant methods X-Git-Tag: release-1.3.2~517 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0a6c4e34c43c9731058d2acc0f3591a13f871135;p=gwtquery.git Remove redundant methods --- diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java index e5c2ce4c..59fae4b3 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java @@ -21,7 +21,6 @@ import static com.google.gwt.query.client.plugins.Widgets.Widgets; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.HashMap; import java.util.List; @@ -198,17 +197,6 @@ public class GQuery implements Lazy { return new GQuery(JSArray.create()); } - /** - * Wrap a GQuery around a collection of existing widget. - */ - public static GQuery $(Collection widgetList){ - JSArray elements = JSArray.create(); - for (Widget w : widgetList){ - elements.addNode(w.getElement()); - } - return $(elements); - } - /** * Wrap a GQuery around an existing element. */ @@ -238,13 +226,12 @@ public class GQuery implements Lazy { } /** - * Create a new GQuery given a list of objects. - * Only node objects will be added; + * Create a new GQuery given a list of nodes, elements or widgets */ - public static GQuery $(@SuppressWarnings("rawtypes") ArrayList a) { + public static GQuery $(@SuppressWarnings("rawtypes")List nodesOrWidgets) { JSArray elements = JSArray.create(); - if (a != null) { - for (Object o : a ) { + if (nodesOrWidgets != null) { + for (Object o : nodesOrWidgets ) { if (o instanceof Node) { elements.addNode((Node)o); } else if (o instanceof Widget) { @@ -352,17 +339,6 @@ public class GQuery implements Lazy { return $(Arrays.asList(widgets)); } - /** - * Wrap a GQuery around a List of existing widget. - */ - public static GQuery $(List widgets){ - JSArray elements = JSArray.create(); - for (Widget w : widgets){ - elements.addNode(w.getElement()); - } - return $(elements); - } - /** * Wrap a JSON object. */ @@ -1631,7 +1607,7 @@ public class GQuery implements Lazy { * producing a new array containing the return values. */ @SuppressWarnings("unchecked") - public ArrayList map(Function f) { + public List map(Function f) { @SuppressWarnings("rawtypes") ArrayList ret = new ArrayList(); for (int i = 0; i < elements().length; i++) { diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java index 5ec1d831..c4616a8e 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/LazyGQuery.java @@ -19,7 +19,6 @@ import static com.google.gwt.query.client.plugins.Events.Events; import static com.google.gwt.query.client.plugins.Widgets.Widgets; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.HashMap; import java.util.List; import com.google.gwt.core.client.GWT; @@ -696,7 +695,7 @@ public interface LazyGQuery extends LazyBase{ * Pass each element in the current matched set through a function, * producing a new array containing the return values. */ - ArrayList map(Function f); + List map(Function f); /** * Bind a set of functions to the mousedown event of each matched element. diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java index 5d5be8fd..304dc9e8 100644 --- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java +++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTest.java @@ -19,7 +19,7 @@ import static com.google.gwt.query.client.GQuery.$; import static com.google.gwt.query.client.GQuery.$$; import static com.google.gwt.query.client.GQuery.document; -import java.util.ArrayList; +import java.util.List; import junit.framework.Assert; @@ -786,7 +786,6 @@ public class GQueryCoreTest extends GWTTestCase { assertEquals(true, isAttachedToTheDOM); } - @SuppressWarnings("unchecked") public void testGQueryWidgets() { final Button b1 = new Button("click-me"); RootPanel.get().add(b1); @@ -817,7 +816,7 @@ public class GQueryCoreTest extends GWTTestCase { String content = "

"; $(e).html(content); - ArrayList s = $("p", e).map(new Function() { + List s = $("p", e).map(new Function() { public Object f(Element e, int i) { return null; } @@ -837,7 +836,7 @@ public class GQueryCoreTest extends GWTTestCase { assertEquals("4", s.get(2)); - ArrayList a = $("p", e).map(new Function() { + List a = $("p", e).map(new Function() { public Object f(Element e, int i) { String id = $(e).attr("id"); return id.isEmpty() ? null: e;