In Java. How do I add an if statement or another method toprevent duplicates from being added to my linked list? This is mycurrent code for adding integers into my linked list in ascendingorder. public void add(int i){
boolean added=false;
for(int j=0;j{
int l=list.get(j);
if(l>i){
list.add((list.indexOf(l)),i);
added=true;
break;
} }
if(!(added))
{
list.addLast(i);
}
} . . .
#Sales Offer!| Get upto 25% Off: