直接上码: public class MyObject { public string name; public override bool Equals(object obj) { if (ReferenceEquals(...
首先我得说明,在我们自己写得类中你能够复写这两个方法,此时从语法的角度来说,他们没关系。 在object中public native int hashCode();public boolean equals(Object obj) { return (this == obj);}两个准...
分类:
其他好文 时间:
2014-10-22 21:33:13
阅读次数:
253
1.__FILE____FILE__ always equals to the real path of a php script regardless whether it's included.__FILE__ helps you specify the file to include usin...
分类:
Web程序 时间:
2014-10-22 20:18:45
阅读次数:
242
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 andsum =...
分类:
其他好文 时间:
2014-10-22 07:36:22
阅读次数:
218
//浮点型判断public static boolean isDecimal(String str) {if(str==null || "".equals(str))return false;java.util.regex.Pattern pattern = Pattern.compile("[0-...
分类:
编程语言 时间:
2014-10-21 17:06:39
阅读次数:
244
解决办法1:
把资源放在assets目录下,文件名用md5加密,比如一个xzy.png文件,md5加密后整个就是一个无厘头的字符串,当你要找它时,就把“zyz.png”这个字符串再md5一次,到assets下去equals,就可以拿到这幅图的InputStream了,你知道的,InputStream 可以decde成Bitmap(Bitmap或者BitmapFactory.decodeByStr...
分类:
其他好文 时间:
2014-10-21 15:28:56
阅读次数:
180
HashSet集合的特点是元素无序和不重复 。
首先,HashSet的底层数据结构是哈希表。哈希表就是存储一系列哈希值的表,而哈希值是由对象的hashCode()方法生成的。
确保元素唯一性的两个方法,hashCode()和equals()方法。
当调用add()方法向集合中存入对象的时候,先比较此对象与原有对象的哈希值有没有一样的,如果都不一样就直接存入;如果有与之相同的哈希值...
分类:
其他好文 时间:
2014-10-21 01:06:41
阅读次数:
167
1、验证: btnLogin.setOnClickListener(new OnClickListener() { ??? ???@Override ???public void onClick(View v) { ????if (!username.getText().toString().equals("liyuhao")) { ?????u...
分类:
其他好文 时间:
2014-10-20 23:31:44
阅读次数:
378
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-10-20 22:58:44
阅读次数:
305
1. 思想与概念很重要最近开始发现计算机科学思想与概念越来越重要了,这不是过时的说教。当你使用Java JDK时,如果不懂优先级队列的概念,可能就弄不明白PriorityQueue的行为;如果不懂哈希表的机理,也无法写出好的equals和hashCode的方法,更不可能用好HashMap;如果不了解...
分类:
其他好文 时间:
2014-10-20 21:08:19
阅读次数:
198