- 浏览: 6002 次
最新评论
文章列表
list,set,map,数组间 转换
- 博客分类:
- Java
1.list转set
Java代码 复制代码
Set set = new HashSet(new ArrayList());
2.set转list
Java代码 复制代码
List list = new ArrayList(new HashSet());
3.数组转为list
Java代码 复制代码
List stooges = Arrays.asList("Larry", "Moe", "Curly");
此时stooges中有有三个元素。
4.数 ...
给map添加add 方法
- 博客分类:
- Java
import java.util.HashMap;
/**
* <p>
* Copyright©2013-2015 AutoChina International Ltd. All rights reserved.
* </p>
* 作为一个基类就可以了
* @Author {Your_Name}
*/
public class MapAddMethord<K, V> extends HashMap<K, V> {
public MapAddMethord<K, V> add(K k, ...
list 转 map 经典实例
- 博客分类:
- Java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
*<p>Copyright©2013-2015 AutoChina International Ltd. All rights reserved.</p>
*@Author {Your_Name}
*/
public class Li ...
public enum TestEnum {
low{
public String toString(){
return "低级别";
}
public String toEnglish(){
return "low level";
}
},
normal{
public String toString(){
return "正常级别";
}
public String toEnglish(){
return "normal level";
}
},
high{
publ ...
常见HTTP状态码
1.200 OK
2.301 Moved Permanently
3.302 Found
4.304 Not Modified
5.307 Temporary Redirect
6.400 Bad Request
7.401 Unauthorized
8.403 Forbidden
9.404 Not Found
10.410 Gone
11.500 Internal Server Error
12.501 Not Implemented
100 Continue
初始的请求已经接受,客户应当继续发送请求的其余部分
101 Switching Protocols
...
package demo;
public class Student implements Comparable//该接口用于排序
{
private int sno;
private String name;
private double score;
public Student(int sno, String name, double score)
{
this.sno = sno;
this.name = name;
this.score = score;
}
public String getName()
{
return name;
}
publ ...