如何删除List <namevaluepair> Android </namevaluepair>的所有元素

时间:2015-04-04 21:55:35

标签: java android

我想从列表中删除所有元素。我有这个代码:

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(???);

1 个答案:

答案 0 :(得分:0)

你检查了arraylist的文档吗? http://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html#clear()

使用httpQueryPairs.clear()