fork download
  1. import com.google.common.collect.HashMultimap;
  2. import com.google.common.collect.Multimap;
  3.  
  4. public class Main {
  5. public static void main(String[] args) {
  6. Multimap<String, Integer> multimap = HashMultimap.create();
  7.  
  8. multimap.put("a", 1);
  9. multimap.put("a", 2);
  10.  
  11. // Remove all elements associated with key "a"
  12. multimap.remove("a", 1);
  13. multimap.remove("a", 2);
  14.  
  15. // Check if the key "a" is still present
  16. System.out.println("Is multimap considered empty now?: " + multimap.isEmpty());
  17. }
  18. }
Success #stdin #stdout 0.18s 56444KB
stdin
Standard input is empty
stdout
Is multimap considered empty now?: true