Reference no: EM131766846 
                                                                               
                                       
Java
Given the specification of a class, write code that uses it.
Suppose that class Bag<Item> is a java.util.Collection that represents a bunch of items, where the same item can appear multiple times. 
It provides methods 
public void add(Item item)  
//adds item to this Bag (if item is already present, it adds another one)  
public int size( )       
//returns the number of items including duplicates
public Item remove( )   
//removes a random item from this Bag and returns a copy of it.
Write the following method. 
You can assume that Item is Comparable
public class X{
//returns the number of different items in bag. Bag is unchanged.
public static int numDifItems( Bag<Item> bag ){