The method sort(List<T>) in the type Collections is not applicable for the arguments (HashSet<Book>) : I have created **HashSet** which contains elements as Book(name,author) .I have used implemented **comparable interface**.But it giving me above error.<br>  <p>Here I have created class as **BookHashSetDemo** where book elements added  as below</p>

    import java.util.Collections;
    import java.util.HashSet;
    public class BookHashSetDemo {
    	public static void main(String[] args) {
    		HashSet<Book> hashSet=new HashSet<Book>();
    		Book book1=new Book("ABC","XYZ");
    		Book book2=new Book("lmn","opq");
    		Book book3=new Book("rst","uvw");
    		Book book4=new Book("ABC","XYZ");
    		
    		hashSet.add(book1);
    		hashSet.add(book2);
    		hashSet.add(book3);
    		hashSet.add(book4);
    		
    		System.out.println(hashSet);
    		Book book=new Book();
    		Collections.sort(hashSet);
    	}`<br>
And created class **Book** where **Comparable Inteface** implemented as below<br>

    class Book implements Comparable<Book> {
    String name;
    String author;
    
    public Book(String name, String author) {
    this.name=name;
    this.author=author;
    }
    public String toString() {
    	return author+"-->"+name;
    	
    }
    @Override
    public int compareTo(Book o) {
    	// TODO Auto-generated method stub
    	return name.compareTo(o.name);
    }
    }
what I am doing wrong??Thanks in advance.

