title: Way to check if two Collections contain the same elements, independent of order?
body: <p>Let say I have two different hashsets as shown below how can I check that two Hashset contain the same elements and these two hashsets are equal, independent of the order of elements in collection, please advise..!!</p>
  
  <pre><code>Set set1=new HashSet();
            set.add(new Emp("Ram","Trainer",34000));
            set.add(new Emp("LalRam","Trainer",34000));
  </code></pre>
  
  <p>and the other one is ..</p>
  
  <pre><code>Set set2=new HashSet();
            set.add(new Emp("LalRam","Trainer",34000));
            set.add(new Emp("Ram","Trainer",34000));
  </code></pre>
  
  <p>The employee pojo is ...</p>
  
  <pre><code>class Emp //implements Comparable
  {
        String name,job;
        public String getName() {
          return name;
      }
      public void setName(String name) {
          this.name = name;
      }
      public String getJob() {
          return job;
      }
      public void setJob(String job) {
          this.job = job;
      }
      public int getSalary() {
          return salary;
      }
      public void setSalary(int salary) {
          this.salary = salary;
      }
      int salary;
        public Emp(String n,String j,int sal)
        {
           name=n;
           job=j;
           salary=sal;
         }
        public void display()
        {
          System.out.println(name+"\t"+job+"\t"+salary);
         }
  
  
  
    public boolean equals(Object o)
        {
  
           Emp p=(Emp)o;
            return this.name.equals(p.name)&amp;&amp;this.job.equals(p.job) &amp;&amp;this.salary==p.salary;
         }
     public int hashCode()
         {
            return name.hashCode()+job.hashCode()+salary;
         }
  
  
        /* public int compareTo(Object o)
         {
            Emp e=(Emp)o;
            return this.name.compareTo(e.name);
             //return this.job.compareTo(e.job);
          //   return this.salary-e.salary;
  
          }*/
  } 
  </code></pre>