将List转成Map结构,以下为没有水平的写法!
好久之前写的土方法转换,不知道有没有优秀的解法,还希望大家提供!
Map map1 = new HashMap();
map1.put("a", "1");
map1.put("b", "3");
map1.put("c", "5");
Map map2 = new HashMap();...
分类:
其他好文 时间:
2014-05-07 08:35:55
阅读次数:
292
这篇对应的是习题39 字典, 可爱的字典
#encoding:utf-8
#列表与字典的区别
#列表
thing = ['name',1,'age','AD','sex']
print thing[1]
#print thing['name'] #会报错,列表只能通过整数去访问:TypeError: list indices must be integers, not str
stuff...
分类:
编程语言 时间:
2014-05-07 06:00:20
阅读次数:
365
[Question]
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to t...
分类:
其他好文 时间:
2014-05-07 05:37:44
阅读次数:
278
eshell是emacs shell的简称,是emacs自带的shell.开始设置的时候还在想是否要找到它的key map (eshell-mode-map?).
原来它是采用hook设置,如下所示
(add-hook 'eshell-mode-hook
(lambda ()
(local-set-key (kbd "C-j") 'switch-to...
分类:
其他好文 时间:
2014-05-07 05:25:39
阅读次数:
253
简单谈谈 Python 中容器的遍历和一下小技巧。
1、遍历单个容器
下面代码遍历一个 List 结构,同样适用于 Tuple、Set 结构类型
>>> x = [1, 2, 3, 'p' , 'y']
>>> for v in x:
... print(x)
...
1
2
3
p
y
遍历字典 Dict 结构也是...
分类:
编程语言 时间:
2014-05-07 04:12:39
阅读次数:
395
下面先来一个网络上的案例,这个案例比较简单,直接在类中进行一些参数的配置,具体代码如下:
package com.wzpmt; import java.util.ArrayList; import java.util.Date; import java.util.List; import com.danga.MemCached.MemCachedClient; impo...
分类:
编程语言 时间:
2014-05-07 03:57:53
阅读次数:
510
package com.array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import...
分类:
编程语言 时间:
2014-05-07 03:45:11
阅读次数:
365
五一中间断了几天,开始继续。。。
1、
??
Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.
Return a...
分类:
其他好文 时间:
2014-05-06 18:54:59
阅读次数:
386
如下图:选择了子数据,默认选中父级数据,数据库中会存储两条数据为使脚本通用性更好,不写死两级,可将数据放到List里处理,代码如下: String
companyName = null; companyName = "测试公司1.1"; stepInfo("校验数据"); DBU...
分类:
其他好文 时间:
2014-05-06 18:14:09
阅读次数:
282
ubuntu12.04服务器可以使用apt-get方式安装NodeJS,但是,安装完后的版本为v0.6.12的版本,如果我们想要使用新一点的版本需要做如下配置:apt-getinstallpython-software-properties
apt-add-repositoryppa:chris-lea/node.js
apt-getupdate
apt-getinstallnodejs安装完成后可以..
分类:
Web程序 时间:
2014-05-06 16:45:52
阅读次数:
378