package gcUnrelatedTypes;

import java.util.Collection;
import java.util.Iterator;
import java.util.Set;

import com.google.common.base.Objects;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multiset;
import com.google.common.collect.Sets;
import com.google.common.collect.Table;

public class Guava {

    
    static class Pair<A,B> {
        final A a;
        final B b;
        public Pair(A a, B b) {
            this.a = a;
            this.b = b;
        }
        @Override
        public int hashCode() {
            final int prime = 31;
            int result = 1;
            result = prime * result + ((a == null) ? 0 : a.hashCode());
            result = prime * result + ((b == null) ? 0 : b.hashCode());
            return result;
        }
        @Override
        public boolean equals(Object obj) {
            if (this == obj)
                return true;
            if (obj == null)
                return false;
            if (getClass() != obj.getClass())
                return false;
            Pair other = (Pair) obj;
            if (a == null) {
                if (other.a != null)
                    return false;
            } else if (!a.equals(other.a))
                return false;
            if (b == null) {
                if (other.b != null)
                    return false;
            } else if (!b.equals(other.b))
                return false;
            return true;
        }
        
    }
    public static void testMultmap(Multimap<String, Integer> mm) {
        mm.containsEntry("x", "y");
        mm.containsEntry(1, 5);
        mm.containsKey(1);
        mm.containsValue("x");
        mm.remove("x", "x");
        mm.remove(1, 2);
        mm.removeAll(1);

    }

    public static void testMultmapOK(Multimap<String, Integer> mm) {
        mm.containsEntry("x", 1);
        mm.containsKey("x");
        mm.containsValue(1);
        mm.remove("x", 1);
        mm.removeAll("x");
    }
    public static void testMultmapOK2(Multimap<String, Pair<Integer,Long>> mm) {
        Pair<Integer, Long> p = new Pair<Integer, Long>(1, 1L);
        mm.containsEntry("x", p);
        mm.containsKey("x");
        mm.containsValue(p);
        mm.remove("x", p);
        mm.removeAll("x");
    }

    public static void testMultiset(Multiset<String> ms) {
        ms.contains(1);
        ms.count(1);
        ms.remove(1);
        ms.remove(1, 2);
    }

    public static void testTable(Table<String, Integer, Long> t) {
        t.contains("x", "x");
        t.contains(1, 1);
        t.containsRow(1);
        t.containsColumn("x");
        t.containsValue(1);
        t.get("x", "x");
        t.get(1, 1);
        t.remove("x", "x");
        t.remove(1, 1);
    }

    public static void testObjects() {
        Objects.equal("x", 1);
    }

    public static void testSets(Set<String> s1, Set<Integer> s2) {
        Sets.intersection(s1, s2);
        Sets.difference(s1, s2);
        Sets.symmetricDifference(s1, s2);
    }

    public static void testIterables(Iterable<String> i, Collection<Integer> c) {
        Iterables.contains(i, 1);
        Iterables.removeAll(i, c);
        Iterables.retainAll(i, c);
        Iterables.elementsEqual(i, c);
        Iterables.frequency(i, 1);
    }

    public static void testIterators(Iterator<String> i, Collection<Integer> c) {
        Iterators.contains(i, 1);
        Iterators.removeAll(i,c);
        Iterators.retainAll(i, c);
        Iterators.elementsEqual(i, c.iterator());
        Iterators.frequency(i, 1);
    }

}

@@ -392,16 +392,121 @@
 Table;%0A%0A
+import edu.umd.cs.findbugs.annotations.ExpectWarning;%0Aimport edu.umd.cs.findbugs.annotations.NoWarning;%0A%0A
 public c
@@ -1658,24 +1658,62 @@
      %0A    %7D%0A
+    @ExpectWarning(value=%22GC%22, num=7)%0A
     public s
@@ -1731,16 +1731,17 @@
 testMult
+i
 map(Mult
@@ -1973,24 +1973,44 @@
 All(1);%0A
-%0A
     %7D%0A%0A
+    @NoWarning(%22GC%22)%0A
     publ
@@ -2028,24 +2028,25 @@
 oid testMult
+i
 mapOK(Multim
@@ -2219,24 +2219,45 @@
 %22x%22);%0A    %7D%0A
+    @NoWarning(%22GC%22)%0A
     public s
@@ -2275,16 +2275,17 @@
 testMult
+i
 mapOK2(M
@@ -2535,32 +2535,70 @@
 ll(%22x%22);%0A    %7D%0A%0A
+    @ExpectWarning(value=%22GC%22, num=4)%0A
     public stati
@@ -2731,32 +2731,70 @@
 e(1, 2);%0A    %7D%0A%0A
+    @ExpectWarning(value=%22GC%22, num=9)%0A
     public stati
@@ -3082,32 +3082,70 @@
 e(1, 1);%0A    %7D%0A%0A
+    @ExpectWarning(value=%22EC%22, num=1)%0A
     public stati
@@ -3381,32 +3381,70 @@
 s1, s2);%0A    %7D%0A%0A
+    @ExpectWarning(value=%22GC%22, num=2)%0A
     public stati
@@ -3686,32 +3686,70 @@
 y(i, 1);%0A    %7D%0A%0A
+    @ExpectWarning(value=%22GC%22, num=2)%0A
     public stati

add expectWarning annotations