解决方案 »

  1.   

    public static <T> List<T> compare(T[] t1, T[] t2) {
    List<T> list1 = Arrays.asList(t1);
    List<T> list2 = new ArrayList<T>();
    for (T t : t2) {
    if (!list1.contains(t)) {
    list2.add(t);
    }
    }
    return list2;
    }
    compare(new Integer[] { 1, 2, 3 }, new Integer[] {
    1, 2, 3, 4 })
      

  2.   

    这要看数组规模 要是几十亿数据 才好玩呢 
    java8 可以直接一个表达式搞定
      

  3.   

    一个list放入set,再把另一个list放入,size增加就是不同的,再反过来执行一遍
      

  4.   

    A/B两数组。
    想象将A/B内的值转换为质数。
    得到所有A数组所有元素的乘积XA。
    迭代B中所有元素,XA%B[n],不能整除的为B中独有。得到所有B集合的乘积XB。
    迭代A中所有元素,XB%A[n],不能整除的为A中独有。
      

  5.   

    可以将数组转换成容器list,然后做交并补之类的操作
      

  6.   

    测试下在线代码编辑public void functin(){
     int min = 0;
    int max = 100;
    }
      

  7.   

    那效率最高的是怎么样弄?lz根本不想问问题的,就是来找事的
    我顶你个肺嘞,nice
      

  8.   

    Could you pls. share it specifically? I mean how to resolve it by Java 8.I'm interested in what you mentioned.
      

  9.   

    对,Hash最快
    Not really. It depends on specific conditions. Exactly speaking, it mainly depends on arithmetic of hashcode and data size.
    There are a pile of solutions for this question with high efficiency.
      

  10.   

    对,Hash最快
    Not really. It depends on specific conditions. Exactly speaking, it mainly depends on arithmetic of hashcode and data size.
    There are a pile of solutions for this question with high efficiency.
    英文不错。
      

  11.   

     现在看到这些 首先就想到collection set 或者map  好像成了定向思维了
      

  12.   

    开个玩笑吧。int [] a = {1,2};
    int [] b = {2,3};
    System.out.println("不同元素师1,3");这个效率高不。
      

  13.   

    对,Hash最快
    Not really. It depends on specific conditions. Exactly speaking, it mainly depends on arithmetic of hashcode and data size.
    There are a pile of solutions for this question with high efficiency.
    英文不错。
    arithmetic of hashcode,
    a pile of solutions
    这风格挺奇葩。。