Stringa=newString(); 此时a是分配了内存空间,但值为空,是绝对的空,是一种有值(值存在为空而已)Stringb="";此时b是分配了内存空间,值为空字符串,是相对的空,是一种有值(值存在为空字串)Stringc=null;此时c是未分配内存空间,无值,是一种无值(值不存在)详细:...
分类:
其他好文 时间:
2015-01-04 16:56:35
阅读次数:
135
https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/http://fisherlei.blogspot.com/2012/12/leetcode-longest-substring-without.htmlpublicclassSolution{
publicintlengthOfLongestSubstring(Strings){
if(s==null||s.isEmpty())
return0;/..
分类:
其他好文 时间:
2015-01-02 16:16:01
阅读次数:
119
BFS有固定的套路 类似下面这个形式ArrayList queue = new ArrayList();queue.add(root);while(!queue.isEmpty()){ String temp = queue.poll(); for(neigbor : t...
分类:
其他好文 时间:
2015-01-01 12:29:05
阅读次数:
125
1、Query Operations(查询操作) int size();boolean isEmpty(); boolean containsKey(Object key);boolean containsValue(Object value);boolean containsValue(Objec...
分类:
其他好文 时间:
2014-12-24 11:30:42
阅读次数:
136
public class RegularUtil { public static boolean checkName(Activity context, String name) { if (TextUtils.isEmpty(name) || name.length() 1...
分类:
移动开发 时间:
2014-12-19 10:01:38
阅读次数:
174
对于字符串处理Android为我们提供了一个简单实用的TextUtils类,如果处理比较简单的内容不用去思考正则表达式不妨试试这个在android.text.TextUtils的类,主要的功能如下:是否为空字符 booleanandroid.text.TextUtils.isEmpty(CharSe...
分类:
移动开发 时间:
2014-12-19 09:58:02
阅读次数:
216
9.1 使用列表 列表类型:跟数组一样,列表也是同质化的(homogeneous)。即所有元素都要是同种类型。 列表结构:所有列表由两部分组成:Nil 和 ::(cons)。 基本操作:主要有三个:head , tail , isEmpty 。这些都定义在List Object里。head 和...
分类:
其他好文 时间:
2014-12-05 14:16:30
阅读次数:
287
3.6 编写程序,按升序对栈进行排序(即最大元素位于栈顶)。最多只能使用一个额外的栈存放临时数据,但不得将元素复制到别的数据结构中(如数组)。该栈支持如下操作:push、pop、peek和isEmpty。解答使用一个附加的栈来模拟插入排序。将原栈中的数据依次出栈与附加栈中的栈顶元素比较, 如果附加栈...
分类:
其他好文 时间:
2014-12-04 21:27:28
阅读次数:
185
1. 三种常用的字符串判空串方法:Length法:bool isEmpty = (str.Length == 0);Empty法:bool isEmpty = (str == String.Empty);General法:bool isEmpty = (str == "");2. 深入内部机制:要探...
8.4Writeamethodtocomputeallpermutationsofastring.ThisisaverysimilarquestiontoCC8.3
staticCollection<String>permutations(Strings)
{
if(s==null||s.isEmpty())
returnCollections.emptyList();
if(s.length()==1)
returnCollections.singletonList..
分类:
其他好文 时间:
2014-12-01 16:14:11
阅读次数:
165