I already made a circular LinkedList via nodal class, then I saw this LinkedList the import.java.util.LinkedList
with operations add, addFirst and etc.
Using this, it could ease the burden traversing and accessing the LinkedList but my problem is, if I want to access the List and put some data in it? how?
public class stckoverflow {
private int x;
public void getx(int y){
x = y;
}
}
// then in the main we have
LinkedList<stckoverflow> ll = new LinkedList<>();
ll.add(0, ????? );
So the point is, if I want to access some functions/procedures in a specific class in the LinkedList, how can I do it? I have no problems accessing these things in the LinkedList via nodal class because I can simply say current gets head and then traverse via while loop until it ends.
I'm confused. Please help.
better obey Java naming convention, name your class as Stackoverflow
or StackOverflow
Stackoverflow obj = new Stackoverflow();
//obj.set attributes if you have
// ...
ll.add( obj );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.