上一页 1 2 3 4 5 6 ··· 8 下一页
摘要: 1.依赖在哪里 老马举了一个小例子,是开发一个电影列举器(MovieList),这个电影列举器需要使用一个电影查找器(MovieFinder)提供的服务,伪码如下:1/*服务的接口*/2publicinterfaceMovieFinder{3ArrayListfindAll();4}56/*服务的消... 阅读全文
posted @ 2014-08-12 02:18 WinsCoder 阅读(672) 评论(0) 推荐(0) 编辑
摘要: 有的观点认为,应该用POST来创建一个资源,用PUT来更新一个资源;有的观点认为,应该用PUT来创建一个资源,用POST来更新一个资源;还有的观点认为可以用PUT和POST中任何一个来做创建或者更新一个资源。这些观点都只看到了风格,争论起来也只是争论哪种风格更好,其实,用PUT还是POST,不是看这... 阅读全文
posted @ 2014-08-12 02:12 WinsCoder 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 什么是hashcode分析HashMap之前先介绍下什么Hashcode(散列码)。它是一个int,每个对象都会有一个hashcode,它在内存的存放位置是放在对象的头部(对象头部存放的信息有hashcode,指向Class的引用,和一些有关垃圾回收信息)。具体如何生成hashcode,这个相当复杂,由于我们的主题是“浅析”,所以不深入探讨。有个问题需要讲的是,如果在你的类中覆盖了Object的equals(Object)方法,那么你必须覆盖hashCode方法,不然,当你使用HashMap,HashSet,HashTable时会出现问题。具体原因下文会详细描述。String类的hashcod 阅读全文
posted @ 2014-02-15 07:36 WinsCoder 阅读(574) 评论(0) 推荐(0) 编辑
摘要: 先看看Java中的HashCode 在Java中,哈希码代表对象的特征。 例如对象 String str1 = “aa”, str1.hashCode= 3104 String str2 = “bb”, str2.hashCode= 3106 String str3 = “aa”, str3.hashCode= 3104 根据HashCode由此可得出str1!=str2,str1==str3 哈希码产生的依据:哈希码并不是完全唯一的,它是一种算法,让同一个类的对象按照自己不同的特征尽量的有不同的哈希码,但不表示不同的对象哈希码完全不同。也有相同的情况,看程序员如何写哈希码的算法。 ... 阅读全文
posted @ 2014-02-15 07:31 WinsCoder 阅读(185) 评论(0) 推荐(0) 编辑
摘要: 下面总结一下有关apt-get的常用但容易混淆的指令:apt-get autoclean: 如果你的硬盘空间不大的话,可以定期运行这个程序,将已经删除了的软件包的.deb安装文件从硬盘中删除掉。如果你仍然需要硬盘空间的话,可以试试 apt-get clean,这会把你已安装的软件包的安装包也删除掉,当然多数情况下这些包没什么用了,因此这是个为硬盘腾地方的好办法。apt-get clean: 类似上面的命令,但它删除包缓存中的所有包。这是个很好的做法,因为多数情况下这些包没有用了。但如果你是拨号上网的话,就得重新考虑了。apt-get autoremove: 删除为了满足其他软件包的依赖而... 阅读全文
posted @ 2014-02-13 03:08 WinsCoder 阅读(214) 评论(0) 推荐(0) 编辑
摘要: Switching between installed Java versions can be accomplished using the update alternatives command.To get a list of your installed Java platforms, run the following command from the terminal:sudo update-alternatives --config javaThis will give you a list output similar to this:There are 2 choices f 阅读全文
posted @ 2014-02-12 03:41 WinsCoder 阅读(142) 评论(0) 推荐(0) 编辑
摘要: If you've downloaded Eclipse from their official website, follow these steps for the installation. (Ubuntu 12.04 LTS)Extract the eclipse.XX.YY.tar.gz usingtar -zxvf eclipse.XX.YY.tar.gzCopy the extracted folder to /optsudo cp -r eclipse.XX.YY /optCreate a desktop file and install it:gedit eclips 阅读全文
posted @ 2014-02-12 03:36 WinsCoder 阅读(145) 评论(0) 推荐(0) 编辑
摘要: Given amxnmatrix, if an element is 0, set its entire row and column to 0. Do it in place.Follow up:Did you use extra space?A straight forward solution using O(mn) space is probably a bad idea.A simple improvement uses O(m+n) space, but still not the best solution.Could you devise a constant space so 阅读全文
posted @ 2014-01-30 07:48 WinsCoder 阅读(150) 评论(0) 推荐(0) 编辑
摘要: A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked 'Finish' in the diagram below).How many possible uni 阅读全文
posted @ 2014-01-30 03:11 WinsCoder 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST.Code:/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Solution {pub... 阅读全文
posted @ 2014-01-29 09:39 WinsCoder 阅读(135) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 8 下一页