Data Structures in Java
Data Structures in Java
• In simple words, a linked list consists of nodes where each node contains a data field and a
reference (link) to the next node in the list.
class LinkedList
{
protected Node start;
protected Node end ;
public int size ;
/* Display List */
list.display();
System.out.println("\nDo you want to continue (Type y or n) \n");
ch = scan.next().charAt(0);
} while (ch == 'Y'|| ch == 'y');
}
}
• LinkedList vs ArrayList:
public MyArrayList(){
this.data=new Object[SIZE_FACTOR];
this.size=SIZE_FACTOR;
}
}
mal.remove(5);
System.out.println(mal.get(7));
}
return con.value;
}
}
return null;
}