在Java中,经常会将一个Object类型转成自己想要的Map、List等等。通常的做法是:Object
obj = ....;Map castMap = (HashMap) obj;在这里会产生unchecked cast
warning,有代码洁癖的就会想办法干掉它。解决办法就是在方法上添加一个...
分类:
其他好文 时间:
2014-05-17 00:32:10
阅读次数:
311
1package com.ztravel.utils;import
java.io.IOException;import java.util.ArrayList;import java.util.List;import
java.util.Map;import org.apache.http.Htt...
分类:
其他好文 时间:
2014-05-17 00:23:54
阅读次数:
261
收获:在运行程序的时候,错误出现。主要是map没有进行判断,是否为空,如果为空,则创建一个对象new
HashMap();然后就注意细节,String name=request.getParameter("name"); String
pass=request.getParameter("pa...
分类:
编程语言 时间:
2014-05-13 17:33:42
阅读次数:
276
由于现在很多业务我都是在copy代码所以代码有的没有用有的对象是null,有的却不是obj=map.get()之后对象的属性有的之前都set好了在map.put的之前又设置了多余吧,应该删掉你
分类:
其他好文 时间:
2014-05-13 17:18:21
阅读次数:
184
题意:给你 n 个坐标(x,y),m 个询问(c,d)
c==0,求出x==d有多少个,并删除这些点;
c==1,求出y==d有多少个,并删除这些点。
map+multiset的多重映射
#include
#include
#include
#include
#include
#include
#include
#include
#include
#includ...
分类:
其他好文 时间:
2014-05-13 15:13:07
阅读次数:
253
实现线程:继承Thread类或者实现Runnable接口由于Handler运行在主线程中(UI线程中),它与子线程可以通过Message对象来传递数据,这个时候,Handler就承担着接受子线程传过来的(子线程用sedMessage()方法传弟)Message对象,(里面包含数据),把这些消息放入主线程队列中,配合主线程..
分类:
其他好文 时间:
2014-05-13 13:14:18
阅读次数:
304
定义接口packagecom.example.android_db.service;
importjava.util.List;
importjava.util.Map;
publicinterfacePersonService{
publicbooleanaddPerson(Object[]params);
publicbooleandeletePerson(Object[]params);
publicbooleanupdatePerson(Object[]params);
publicMa..
分类:
移动开发 时间:
2014-05-13 13:06:04
阅读次数:
454
importjava.util.HashMap;
importjava.util.Map;
importandroid.content.Context;
importandroid.content.SharedPreferences;
publicclassMySharedpreference{
privateContextcontext;
publicMySharedpreference(Contextcontext){
//TODOAuto-generatedconstructorstub
this.co..
分类:
移动开发 时间:
2014-05-13 12:10:38
阅读次数:
346
Problem Description
Acmers have been the Earth Protector against the evil enemy for a long time, now it’s your turn to protect our home.
There are 2 * n enemies in the map. Your task is to clear a...
分类:
其他好文 时间:
2014-05-13 11:29:40
阅读次数:
308
这往往是引用的问题。ARC要求完整的前向引用,也就是说在MRC时代可能只需要在.h中申明@class就可以,但是在ARC中如果调用某个子类中未覆盖的父类中的方法的话,必须对父类.h引用,否则无法编译。
有一篇文章讲的很详细
本文部分实例取自iOS 5 Toturail一书中关于ARC的教程和公开内容,仅用于技术交流和讨论。请不要将本文的部分或全部内容用于商用,谢谢合作。
欢迎转载...
分类:
其他好文 时间:
2014-05-13 11:18:21
阅读次数:
263