Java拓展

位运算

https://www.cnblogs.com/liaopeng/p/8436155.html

0>>1 = 0  (0<<1) + 1 = 1 

0<<1 = 0  (0>>1) + 1 = 1 

1&1 = 1, 0&1 = 0;

Hashmap basic methods:

https://www.cnblogs.com/jiuhaoyun/p/8985643.html

  • HashSet:

    https://blog.csdn.net/tingzhiyi/article/details/52152487

  • The difference between iteration and recursion:

  https://blog.csdn.net/swliao/article/details/5337896

Arrays类中常见的一些方法https://blog.csdn.net/goodbye_youth/article/details/81003817

链表的使用  https://www.cnblogs.com/qianguyihao/p/4782595.html

茴字的四种写法之HashMap  https://blog.csdn.net/gm371200587/article/details/82108372 (最好的办法是用for循环Map.Entry<k,v> entry : map.Entryset(), 然后访问entry.getKey(), getValue())是是是HashMap,TreeMap,LinkedHashMap的区别(hashmap无序,treemap按键升序,LinkedHashMap按插入时顺序)https://www.cnblogs.com/qlqwjy/p/8046715.html

·发现了个屌的----lambda表达式修改comparator的顺序

        List<Integer> list = new ArrayList();
        list.add(2);
        list.add(1);
        list.add(4);
        list.add(3);
        Collections.sort(list);
        //打印出1,2,3,4
        Collections.sort(list,(a,b)->b-a);
        //打印出4,3,2,1

里面(a,b)->b-a相当于重写了一个implement Comparator的Class

  •   ArrayList 转成 array
  • String[] arr = mlist.toArray(new String[0]);
  • Array 转成 ArrayList
List<String> mlist = Arrays.asList(array);

 图论之floyd warshall

 https://www.luogu.com.cn/blog/wym483739/xue-tu-lun-ni-zhen-di-liao-xie-zui-duan-lu-ma-post

X. <? extends T>

<? super T>

带有super超类型限定的通配符可以向泛型对象中写入,带有extends子类型限定的通配符可以向泛型对象读取。

https://blog.csdn.net/jdsjlzx/article/details/70479227?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.nonecase

X. Class.forName(), Class.class, Class.getClass()

  • a.getClass() returns the runtime type of a. I.e., if you have A a = new B(); then a.getClass() will return the B class.

  • A.class evaluates to the A class statically, and is used for other purposes often related to reflection.

  • Class.forName() gives you the class object, which is useful for reflection
原文地址:https://www.cnblogs.com/wentiliangkaihua/p/10527770.html