Single Linked List Using Java Web Service: 1. Source Code
Single Linked List Using Java Web Service: 1. Source Code
Single Linked List Using Java Web Service: 1. Source Code
|SOA Lab
|SOA Lab
else
{
ii.link=new node();
ii=ii.link;
ii.d=Integer.parseInt(lt.get(i).toString());
c++;
}
// if it is last node
if(i==lt.size()-1)
{
ii.link=null;
}
}
return "Single Linked List is created successfully with "+String.valueOf(c)+" nodes..." ;
}
else
return "List is empty!plz submit the elements "+String.valueOf(c);
}
// display the elements
@WebMethod(operationName = "Dispaly")
public String Dispaly() {
// set the base address to node dd
3
|SOA Lab
node dd=root;
StringBuffer sb=new StringBuffer();
if(dd!=null)
{
while(dd!=null)
{
sb.append(dd.d+"-->");
dd=dd.link;
}
return "Elements in the LL:\n"+sb.toString();
}
else
return "List is empty!Plz add elements";
}
}
|SOA Lab
2. OUTPUT
2.1 CREATE A DYNAMIC LIST
|SOA Lab
|SOA Lab
|SOA Lab