标签:
1 | public static void up(List<? extends Number> l){ //方法的具体实现 } |
1 | public static void down(List<? super Number> l){ //方法的具体实现 } |
1 2 | List<Integer> l1 = new ArrayList<Integer>(); List l2 = l1; |
1 | public static <T>List<T> asList(T ... t){} |
1 2 3 4 5 6 7 8 9 10 11 12 13 | int [] arr = { 1 , 2 , 3 }; List<Integer> l1 = Arrays.asList(arr); //ERROR List< int []> l2 = Arrays.asList(arr); //YES Integer[] arr1 = arr; //ERROR Integer[] arr1 = { 1 , 2 , 3 }; List<Integer> l3 = Arrays.asList(arr1); List <----> 数组 List-->数组: Collection接口里的 Object[] toArray(); List l = new ArrayList(); l.add( 1 ); l.add( "a" ); l.add( false ); Object[] arr= l.toArray(); |
1 2 3 | List list = new ArrayList(); String ele = (String)set.get( 0 ); List<String> list = new ArrayList<String>(); |
1 | String ele = set.get( 0 ); |
1 | String ele = (String)set.get( 0 ); |
1 2 3 4 5 6 7 8 9 | Map<String,Date> map = new HashMap<String,Date>(); map.put( "A" , new Date()); Set<Map.Entry<String,Date>> entrys = map.entrySet(); //取出Map里所有Entry对象 Iterator<Map.Entry<String,Date>> it = entrys.iterator(); //使用迭代器 //迭代出每一个Entry对象 while (it.hasNext()) { Map.Entry<String,Date> entry = it.next(); //取出每个entry里的 key和 value String key = entry.getKey(); Date value = entry.getValue(); } //show(new HashMap<>()); |
1 | public static <T> List<T> asList(T ... t){ } |
1 | static Class<?> forName(String className) |
标签:
原文地址:http://www.cnblogs.com/lindongdong/p/5d91db0a500877ee8f3f5ac3b5595fd3.html