hibernate的批量更新、批量删除

1、无重复字符的最长子串

自己用java实现的算法

public int lengthOfLongestSubstring(String s) {
int length = 0;
char[] chars = s.toCharArray(); Map<Character, Set<Character>> map = new LinkedHashMap<>();
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
Set<Character> set = new HashSet<>();
for (int j = i; j < chars.length; j++) {
char cj = chars[j];
if (!set.contains(cj)) {
set.add(cj);
} else {
break;
}
}
if (map.get(c) == null || map.get(c).size() < set.size()) {
map.put(c, set);
}
} for (Map.Entry<Character, Set<Character>> entry : map.entrySet()) {
int lengthTmp = entry.getValue().size();
if (lengthTmp >= length) {
length = lengthTmp;
}
}
return length;
}

2、

上一篇:android http 通信(httpclient 实现)


下一篇:java eclipse 监视选择指定变量