/**
*
*/
package com.you.demo;
/**
* @author YouHaiDong
* @date 2015-04-02
*/
public class Welcome
{
/**
* @param args
*/
public static void main(String[] args)
{
String str1 = "you"...
分类:
编程语言 时间:
2015-04-02 20:58:08
阅读次数:
157
在java的集合中,判断两个对象是否相等的规则是:
1)、判断两个对象的hashCode是否相等 。
如果不相等,认为两个对象也不相等,完毕
如果相等,转入2)
(这一点只是为了提高存储效率而要求的,其实理论上没有也可以,但如果没有,实际使用时效率会大大降低,所以我们这里将其做为必需的。后面会重点讲到这个问题。)
2)、判断两个对象用equals运算是否相等 ...
分类:
编程语言 时间:
2015-04-02 15:11:25
阅读次数:
122
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 =...
分类:
其他好文 时间:
2015-04-02 15:01:01
阅读次数:
112
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...
分类:
其他好文 时间:
2015-04-02 14:48:37
阅读次数:
163
1 根类object中的equals()与==没有区别: 如普通类Person中: Person per1 = new Person("张三",20); Person per2 = new Person("张三",20); System.out.print(per1.equals(per2));的结...
分类:
编程语言 时间:
2015-04-01 19:25:26
阅读次数:
169
1 import java.util.*; 2 3 public class Test { 4 public static void main(String[] args) { 5 Collection c = new HashSet(); 6 c.add...
分类:
其他好文 时间:
2015-04-01 15:01:55
阅读次数:
175
Java中集合(Collection):一类是List另外一类是Set; 区别:list中元素有序,可重复 Set元素无序,不能重复如何保证元素不重复呢?Object.Equals但是当添加的元素到后面会非常多,每添加一个元素就增加一个,就会检查一次,比如添加10001个元...
分类:
其他好文 时间:
2015-04-01 13:01:39
阅读次数:
90
在mvc项目中var ls = (from i in gt.vendor_login join j in gt.vendor on i.vendor_id equals j.vendor_id into AAA from j in AAA.DefaultIfEmpty() select new my...
分类:
其他好文 时间:
2015-03-31 14:40:26
阅读次数:
113
HashMap 重新学习 先使用 HashCode() 方法,该方法决定位置。 然后使用 equals() 方法,决定在相同位置的时候,是否覆盖。 当程序试图将一个键值对放入 HashMap 的时候,程序首先根据该 key 的 hashCode() 返回值决定该 Entry 的存储位置:如果两...
分类:
其他好文 时间:
2015-03-31 14:17:58
阅读次数:
101
翻译自:Top 10 questions of Java Strings 1.怎样比较字符串?用”==”还是用equals()?简单地说,”==”测试两个字符串的引用是否相同,equals()测试两个字符串的值是否相同。除非你希望检查两个字符串是否是同一个对象,否则最好用equals()。 如果你知...
分类:
编程语言 时间:
2015-03-31 10:39:57
阅读次数:
111