/*发送一个自定义广播 *指定广播目标Action *可通过Intent携带消息 *发送广播消息 */ privatevoidsendMyBroadcast(){ Intentintent=newIntent("MyReceiver_Action"); intent.putExtra("msg","发送自定义的广播"); sendBroadcast(intent); }//自己写的一个广播类publicclass..
分类:
其他好文 时间:
2014-08-18 18:51:19
阅读次数:
177
HashSet是Set接口的实现类,因此,HashSet中的元素也是不能重复的。HashCode判断元素重复的标准时,首先计算新添加元素的hashCode值,当不重复是,则直接加入到该集合中,若发生重复,也称发生了碰撞,则进一步调用equals判断元素是否在逻辑上相同。 package cn.cqu...
分类:
其他好文 时间:
2014-08-17 19:57:02
阅读次数:
258
1) 对象相等则hashCode一定相等;2) hashCode相等对象未必相等。== 对象的值equals 对象hashCode是jdk根据对象的地址或者字符串或者数字算出来的int类型的数值 详细了解请 参考 [1] public int hashCode()返回该对象的哈希码值。
分类:
其他好文 时间:
2014-08-17 19:54:32
阅读次数:
237
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum ...
分类:
其他好文 时间:
2014-08-16 22:24:21
阅读次数:
212
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo...
分类:
其他好文 时间:
2014-08-16 22:21:41
阅读次数:
235
publicclassTest{
publicstaticvoidmain(String[]args){
Integerj=192;
inti=192;
System.out.println(newInteger(12)==newInteger(12));//false对象比较。///必然不同
System.out.println(newInteger(192)==i);//true自动拆箱
System.out.println(j==i);//true..
分类:
其他好文 时间:
2014-08-15 14:48:19
阅读次数:
222
Android系统自带下载管理(DownloadManager) 进度监听 通过内容观察者实现. 完成时的监听通过广播接受者实现. intent.getAction().equals(DownloadManager. ACTION_DOWNLOAD_COMPLETE) bug4.4三星 java.l...
分类:
移动开发 时间:
2014-08-15 09:22:57
阅读次数:
197
分析问题 在本书前面的章节中,笔者已经介绍过System.Object中的所有方法。而其中有三个方法被设计用来进行对象的比较,它们是: (1)、static bool ReferenceEquals(object A,object B)。 (2)、static bool Equals(obje...
分类:
其他好文 时间:
2014-08-15 09:22:07
阅读次数:
248
import java.util.Set;
import java.util.HashSet;
public class SetTest {
public static void main(String[] args) {
/*
*对于用户自定义类型的数据放在容器(Set)中
*务必重写equals和hashCode方法
*要不然stu1和stu2放在容器中,和认为是两...
分类:
其他好文 时间:
2014-08-14 16:48:58
阅读次数:
190
(单独把一个东西说清楚,然后再说清楚另一个,这样,它们的区别自然就出来了,混在一起说,则很难说清楚)
==操作符专门用来比较两个变量的值是否相等,也就是用于比较变量所对应的内存中所存储的数值是否相同,要比较两个基本类型的数据或两个引用变量是否相等,只能用==操作符。
如果一个变量指向的数据是对象类型的,那么,这时候涉及了两块内存,对象本身占用一块内存(堆内存),变量也占用一...
分类:
其他好文 时间:
2014-08-14 14:11:08
阅读次数:
256