1 //覆写Object.equals 2 class Demo { 3 private String name; 4 private int age; 5 public Demo(String name,int age) { 6 this.name=name; 7 this.age=age; 8 ... ...
分类:
编程语言 时间:
2019-10-16 19:50:48
阅读次数:
102
①HashMap的工作原理 HashMap基于hashing原理,我们通过put()和get()方法储存和获取对象。当我们将键值对传递给put()方法时,它调用键对象的hashCode()方法来计算hashcode,让后找到bucket位置来储存值对象。当获取对象时,通过键对象的equals()方法 ...
分类:
其他好文 时间:
2019-10-16 13:34:42
阅读次数:
93
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. N ...
分类:
其他好文 时间:
2019-10-16 11:19:18
阅读次数:
79
Given a string S and a string T, count the number of distinct subsequences of S which equals T. A subsequence of a string is a new string which is for ...
分类:
其他好文 时间:
2019-10-16 09:36:12
阅读次数:
68
公司最近有一个从ftp批量下载文件的需求,但是文件名重复总会报错 没办法,自己下班后写了一个小算法 仿照桶排序的原理,实现了这个小功能,直接上代码: ...
分类:
其他好文 时间:
2019-10-16 00:38:56
阅读次数:
109
1. redis keys 的 架构排布基于hashmap , a . hashcode -> hash 槽 b . 16838 槽位 寻找执行范围 2. zset 用于战绩排行计数 3. mysql inno --聚簇 4. explain ref 、 key 、type(user index) ...
分类:
其他好文 时间:
2019-10-16 00:17:36
阅读次数:
84
配置文件和配置类 一、定义jedis接口 二、定义IJedisService的实现类 三、单机模式的具体实现 四、Sentinel模式的具体实现 五、Cluster模式的具体实现 六、注入Bean ...
分类:
其他好文 时间:
2019-10-15 13:27:04
阅读次数:
78
==:符号两边数据类型必须兼容(一边数据类型能转成另一边数据类型) 1.比较基本数据类型:比较两个变量值是否相等 2.比较引用数据类型:比较是否指向同一数据对象 equals:只能比较引用类型 1.比较一般引用类型:作用与“==”相同,比较是否指向同一对象 2.比较特殊引用类型:File、Strin ...
分类:
其他好文 时间:
2019-10-15 11:35:48
阅读次数:
98
项目概述 根据输入的出发站和终点站推荐最短路线,显示搭乘线路及经过站点 采用Dijkstra算法,采用HashMap作为主要数据存取结构 运行结果: 代码分析 txt文件用空格分隔,先存储在LinkedHashSet中 public class Data { public static Linked ...
分类:
其他好文 时间:
2019-10-14 23:36:38
阅读次数:
122
问题: 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标。 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 示例: 来源:力扣(LeetCode)链接:https://leetcode-cn.c ...
分类:
其他好文 时间:
2019-10-14 14:23:28
阅读次数:
84