Kli
Kli
java
package core;
public class Book {
private int bookid;
private String booktitle;
private String bookauthor;
private double price;
2.Test.java
package core;
public class Test {
3.Node.java
package core;
this.book = book;
this.next=null;
}
public Book getBook() {
return book;
}
public void setBook(Book book) {
this.book = book;
}
public Node getNext() {
return next;
}
public void setNext(Node next) {
this.next = next;
}
}
4
package core;
import java.util.ArrayList;
import java.util.List;
public SinglyLinkedList()
{
head=null;
}
if(head == null)
{
head=newnode;
count++;
return true;
Node temp=head;
while(temp.getNext()!=null)
{
temp=temp.getNext();
}
temp.setNext(newnode);
count++;
return true;
newnode.setNext(head);
head=newnode;
return true;
}
Node del=head;
Node temp=del;
for(int i=1;i<pos;i++)
{
temp=del;
del=del.getNext();
}
temp.setNext(del.getNext());
return true;
clist.stream().sorted((s1,s2)-
>((Double)s2.getPrice()).compareTo(s1.getPrice())).forEach((s)-
>System.out.println(s));
Node temp=head;
for(int i=1;i<pos-1;i++)
{
temp=temp.getNext();
}
newnode.setNext(temp.getNext());
temp.setNext(newnode);
return true;
}
}