我想从列表中删除所有元素。我有这个代码:
private List<NameValuePair> httpQueryPairs;
httpQueryPairs = new ArrayList<NameValuePair>(1);
httpQueryPairs.add(new BasicNameValuePair("A", foo));
httpQueryPairs.add(new BasicNameValuePair("B", bar));
httpQueryPairs.add(new BasicNameValuePair("C, "Help me i don't know how to delete all elements;)"));
httpQueryPairs.removeAll(???);
答案 0 :(得分:0)
你检查了arraylist的文档吗? http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#clear()
使用httpQueryPairs.clear()