|
|
一些老要用的代码,写下来,年纪大了,记不住,hoho
for (Iterator i = groups.iterator(); i.hasNext();) { Group group = (Group) i.next(); System.out.println(group.get**()); }
2.String int 的互相转换
String test="1";int i=Integer.parseInt(test);int i=1;String test=Integer.toString(i);
http://hi.baidu.com/9prior/blog/item/41382b2535bc946535a80f3e.html
3.hidden
<input type="hidden" id="isok" value="true" />
4.时间问题
Date date=new Date();SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");sdf.format(date);
5.integer之间的比较
a.equals(new Integer(1))
6.遍历map
public SimpleOperationRepostitory(Map<String, Integer> initRepos) {this();for (Entry<String, Integer> e : initRepos.entrySet()) {repos.put(e.getKey(), BaseOperation.build(e.getValue(), e.getKey()));}}
7.switch用法
public boolean doAssert(Object value) {if (value instanceof String) {String str = (String) value;switch (option) {case ANCESTOR_OR_EQUAL:return str.startsWith(hierachyLimit);case ANCESTOR:return str.startsWith(hierachyLimit)&& str.length() > hierachyLimit.length();case DESCENDANT_OR_EQUAL:return hierachyLimit.startsWith(str);case DESCENDANT:return hierachyLimit.startsWith(str)&& hierachyLimit.length() > str.length();default:return false;}}return false;}
8.简单描写
return result > 0 ? true : false;
9.遍历
Set<String> permissions = new LinkedHashSet<String>();for (String roleName : roleNames) {}
10.类的声明
private static final long serialVersionUID = 1L;
11.log语句
private static final Logger logger = Logger.getLogger(VersionDBServiceImpl.class);logger.debug |
|