Guest User

Untitled

a guest
Oct 15th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. //declaration section
  2. Multimap<Location, Interconnect> interconnects;
  3. interconnects = TreeMultimap.create(Ordering.natural(),
  4. Interconnect.ORDER_NATURAL_NULLCHECK);
  5.  
  6. //comparator provider
  7. static final Ordering<Interconnect> ORDER_NATURAL_NULLCHECK = new Ordering<Interconnect>() {
  8.  
  9. @Override
  10. public int compare(@Nullable final Interconnect arg0,
  11. @Nullable final Interconnect arg1) {
  12. return Ordering.natural().nullsFirst().compare(arg0, arg1);
  13. }
  14. };
  15.  
  16. //and I can do kind of the following quite happily:
  17. interconnects.put(new Location(), null);
  18. interconnects.put(new Location(), null);
  19. interconnects.put(new Location(), null);
  20. interconnects.put(new Location(), new Interconnect("A"));
  21. interconnects.put(new Location(), new Interconnect("A");
Add Comment
Please, Sign In to add comment