android 集合之间的包含关系

有些需求需要看看两个个集合之间是否完全包含,

如果不完全包含需要进行其他操作(eg:下载图片)

此时需要使用到Java中Collection接口的containAll()方法

转载于:https://my.oschina.net/arrom/blog/262559

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
仿某团list里嵌套list\ package com.zl.listview; import java.util.ArrayList; import java.util.HashMap; import com.kjy.kjylistview.R; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ListView; import android.widget.Toast; /** * @author zl * @time 2014年12月24日15:37:18 */ public class QianTaoListviewActivity extends Activity { private ListView listView; private ArrayList<HashMap<String, Object>> parentList, childList; private ParentAdapter parentAdapter; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_qiantao); init(); } private void init() { listView = (ListView) findViewById(R.id.qiantao_lv); getList(); } private void getList() { parentList = new ArrayList<HashMap<String, Object>>(); for (int i = 1; i < 10; i++) { childList = new ArrayList<HashMap<String, Object>>(); for (int j = i < 7 ? i : 7; j < 9; j++) { HashMap<String, Object> ParentMap = new HashMap<String, Object>(); ParentMap.put("parent_title", "三木铁板烧" + i); ParentMap.put("parent_address", "8." + i); ParentMap.put("parent_distance", "1" + i); ParentMap.put("parent_distance1", "已售123" + i); childList.add(ParentMap); } HashMap<String, Object> map = new HashMap<String, Object>(); map.put("child_item_title", "九州八拖二火锅" + i); map.put("child_item_price_old", "4." + i + "分"); map.put("child_item_price_score", "(100人)"); map.put("parent_lv", childList); parentList.add(map); } parentAdapter = new ParentAdapter(parentList, QianTaoListviewActivity.this); listView.setAdapter(parentAdapter); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { Intent intent = new Intent(QianTaoListviewActivity.this, Activity_1.class); Toast.makeText(QianTaoListviewActivity.this, "第" + arg2 + "个条目", Toast.LENGTH_LONG).show(); startActivity(intent); } }); } }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值