码迷,mamicode.com
首页 >  
搜索关键字:equals    ( 4544个结果
黑马程序员_JavaSE学习总结第19天_IO流1
------- android培训、java培训、期待与您交流! ----------19.01 集合的特点和数据结构总结HashSet、HashMap、Hashtable判断元素唯一性的方式:通过对象的hashCode和equals方法来完成元素唯一性如果对象的hashCode值不同,那么不用判断...
分类:编程语言   时间:2015-05-26 23:26:20    阅读次数:185
Java学习笔记--“==”与"equals"
java中的数据类型,可分为两类: 1. 基本数据类型,也称原始数据类型。byte,short,char,int,long,float,double,boolean 他们之间的比较,应用双等号(==),比较的是他们的值。 2. 复合数据类型(类) 当他们用(==)进行比较的时候,比较的是他们...
分类:编程语言   时间:2015-05-26 21:18:33    阅读次数:159
Java Object详解
我们都知道:在Java中,所有的类都继承了Object这个基类,并且大家都知道,Object有几个比较通用的方法,如equals(),clone(),toString(),我们需要在使用它们的时候进行覆写,今天,我们就具体的探究下这几个方法。...
分类:编程语言   时间:2015-05-26 19:18:24    阅读次数:155
LeetCode--path sum ii
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-05-26 18:13:18    阅读次数:136
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.Fo...
分类:其他好文   时间:2015-05-26 11:58:25    阅读次数:117
容器相关
一.HashMap的实现机制 1.HashMap是基于哈希表的map接口的非同步实现。HashMap相当于一个数组,数组的每个元素为一个链表。 2.向HashMap中插入一个Entry时,先计算Key的hashcode,根据hashcode确定Entry在数组中的位置,再根据equals判断是否.....
分类:其他好文   时间:2015-05-26 10:31:54    阅读次数:130
JDK中ArrayList、HashMap和HashSet的equals方法源码分析
最近遇到个坑,在进行ArrayList和HashMap进行比较时,发现数据一样,但equals一直返回false。于是乎看了一下ArrayList和HashMap的源码,才恍然大悟。本文的代码摘自JDK 1.7.0。 ArrayList的equals方法: public boolean equals(Object o) { if (o == this) return...
分类:其他好文   时间:2015-05-25 18:43:47    阅读次数:127
Java for LeetCode 112 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.Fo...
分类:编程语言   时间:2015-05-23 21:22:23    阅读次数:152
Java for LeetCode 113 Path Sum II
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 ...
分类:编程语言   时间:2015-05-23 21:16:11    阅读次数:196
HashSet中如何去除重复的对象
通过查看java底层api实现可以发现在hashset中比较2个值是否相等,他是比较的hash值和equals方法,所以我们只需要重写这2个方法即可。 实例程序: package?com; import?java.util.HashSet; import?java.util.S...
分类:其他好文   时间:2015-05-22 19:48:58    阅读次数:193
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!