自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 问答 (3)
  • 收藏
  • 关注

原创 Redis设计原理与实现 Redis链表

Redis的链表设计与实现链表键、发布和订阅、慢查询、监视器等功能都用到了链表,Redis服务器本身还使用链表来保存多个客户端的状态信息,以及使用链表来构建客户端输出缓冲区(output buffer)Redis的链表是非环形双向链表typedef struct list{ //表头节点 listNode *head; //表尾节点 listNode *t...

2019-03-01 18:28:19 203

原创 Redis设计原理与实现 Redis字符串设计

Redis字符串设计Simple dymatic string SDS字符串设计SDS对象 //sds字符串 int free; 2 //当前字符串空间剩余未分配长度 int len; 4 //当前字符串总长度 char[] buf; //当前字符串保存 'a' 'b' 'c' '' 'd' '\0' 空格 空格SDS字符串扩展规则:...

2019-02-26 20:28:11 206

原创 两个有序数组的中间值(Median of Two Sorted Arrays)__By leetCode

Examplenums1 = [1, 3]nums2 = [2]The median is 2.0nums1 = [1, 2]nums2 = [3, 4]The median is (2 + 3)/2 = 2.5 求两个有序数组的中间值One public double findMedianSortedArrays(int[] a, int...

2018-08-15 11:27:48 857

原创 字符串中查找最大连续不重复字符串(Longest Substring Without Repeating Characters)__By leetCode

Given a string, find the length of the longest substring without repeating characters. Examples: Given “abcabcbb”, the answer is “abc”, which the length is 3. Given “bbbbb”, the answer ...

2018-08-13 16:05:59 1214

原创 两数之和 (Add Tow Numbers)__by leetCode

You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and retur...

2018-08-13 14:27:38 146

原创 两数之和问题(Two sum )__by leetCode

题目Given nums = [2, 7, 11, 15], target = 9,Because nums[0] + nums[1] = 2 + 7 = 9,return [0, 1].Onepublic int[] twoSum(int[] old, int target){ for(int i=0; i<old.length; i++) { ...

2018-08-13 10:59:56 163

原创 sunday算法简单解析

sunday算法解析##### Sunday算法由Daniel M.Sunday在1990年提出,它的思想跟BM算法很相似: 只不过Sunday算法是从前往后匹配,在匹配失败时关注的是文本串中参加匹配的最末位字符的下一位字符。 如果该字符没有在模式串中出现则直接跳过,即移动位数 = 匹配串长度 + 1; 否则,其移动位数 = 模式串中最右端的该字符到末尾的距离+1。 ...

2018-08-03 15:42:26 736

原创 Mybatis返回map自动转驼峰

配置MapWrapper.javaimport com.google.common.base.CaseFormat;import org.apache.ibatis.reflection.MetaObject;import org.apache.ibatis.reflection.wrapper.MapWrapper;import java.util.Map;public class Custo

2018-04-20 15:11:16 6670 1

原创 mybatis注解插入list

mybatis注解模式循环插入数据附上源码@Insert({" insert into user_coupon(user_id,coupon_id,total_count," + "memo,start_time,end_time,create_time,type) " + "values " + " "+

2018-01-14 19:55:51 4586

原创 java集合

持有对象 如果一个程序只包含固定数量的且其生命周期都是已知的对象,那么这是一个非常简单的程序。1 泛型和类型安全的容器public static void main(String[] args){ List<String> stringList = new ArrayList<>(); stringList.add("one"); -- stringL

2017-12-26 22:54:32 152

原创 java的反射机制使用

通过反射对集合进行操作@Test Set<String> set = new HashSet<>(); set.addAll(Arrays.asList("my dog is very beautiful".split(" "))); try { Class clazz = Class.forName(set.getClass().getName())

2017-12-24 22:26:09 123

原创 List的subList产生的异常

List调用subList public void test(){ List<Integer> lists = new ArrayList<>(Arrays.asList(1,2,3,4,5)); System.out.println("1:"+lists); List<Integer> list2 = lists.subList(0,2);

2017-12-24 17:09:46 1617

原创 Java中T和?的区别

T和?的区别@Testpublic voidtestOne(){// ?做对象的泛型来用List list = findAllList(1);list.forEach(temp ->{System.out.print(temp);});System.out.println();List lists = findAllList(2);lists

2017-11-19 20:58:29 7699 1

原创 Java文件压缩代码

importjava.io.*;importjava.nio.charset.Charset;importjava.util.zip.ZipEntry;importjava.util.zip.ZipInputStream;public classzipDecompresssion {public static voidmain(String[]

2017-11-19 20:56:51 310

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除