码迷,mamicode.com
首页 >  
搜索关键字:equals    ( 4544个结果
编写一个比较完美的equals方法的建议(java)
1.显示参数命名为otherObject,稍后需要将它转换成另一个叫做other的变量。2.检测this与otherObject是否引用同一个对象:if(this==otherObject) return true;这条语句只是一个优化。实际上,这是一种经常采用的额形式。因为计算这个灯饰要比一个一个...
分类:编程语言   时间:2015-07-07 22:31:54    阅读次数:197
java写代码时的一些注意点
1. if(username.equals(“zxx”)){} 这样写的话,如果username是null, 则会报NullPointerException,所以先要判断username是否为null.2. int x = 1; return x==1?true:false; 不会报错,但特别啰嗦....
分类:编程语言   时间:2015-07-07 14:33:31    阅读次数:142
sd卡存在判断
Boolean sdCardExist = Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED); if (sdCardExist) { SDCardPath = Envir...
分类:其他好文   时间:2015-07-07 12:54:11    阅读次数:131
java该HashTable,HashMap和HashSet
同一时候我们也对HashSet和HashMap的核心方法hashcode进行了具体解释,见《探索equals()和hashCode()方法》。万事俱备,那么以下我们就对基于hash算法的三个集合HashTable,HashSet和HashMap具体解释。本文文件夹:1. HashTable和Hash...
分类:编程语言   时间:2015-07-06 21:21:07    阅读次数:183
关系型数据之LinQ基本查询
如下图所示关系型数据,LinQ语句为:var Query= from a in data.Awhere a.admin==传入的用户名&&a.pwd==传入的密码(可以传入一个model实体)join b in data.B on a.bid equals b.id into ...
分类:其他好文   时间:2015-07-06 17:41:58    阅读次数:87
LeetCode112 PathSum Java题解
题目: 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. For example: Given the below binary tree...
分类:编程语言   时间:2015-07-06 12:18:44    阅读次数:94
EF的连表查询Lambda表达式
var lst = from c in db.Blogs join p in db.Posts on c.Id equals p.BlogId where p.Id==1 select c;var lst1 = db.Blogs.Join(db.Posts.Where(p=>p.Id==1), b=...
分类:其他好文   时间:2015-07-06 09:59:35    阅读次数:243
Path Sum II
Description: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 t...
分类:其他好文   时间:2015-07-04 18:21:09    阅读次数:91
[Leetcode]-Path Sum
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.For example: Given the below binary tree and sum = 2...
分类:其他好文   时间:2015-07-04 15:32:56    阅读次数:95
Android中如何判断内存卡是否存在
if (Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) { /* 得到SD卡得路径 */ mRecAudioPath = ...
分类:移动开发   时间:2015-07-03 15:23:38    阅读次数:159
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!