Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class IntList{
- private int a;
- private IntList LE;
- private IntList RI;
- private static int Pointer=0;
- IntList(int A, IntList B,IntList C){
- a=A;
- LE=B;
- RI=C;
- }
- IntList(int A){
- a=A;
- LE=null;
- RI=null;
- }
- IntList getnext() {
- return RI;
- }
- void add(int In) {
- IntList Neu=new IntList(In,null,this);
- while (RI!=null) {
- this.next();
- }
- this.RI=Neu;
- }
- void next() {
- IntList Temp=this;
- a=RI.get();
- LE=Temp;
- RI=RI.getnext();
- }
- IntList copyof() {
- IntList Out=new IntList(this.a,this.LE,this.RI);
- return Out;
- }
- public static IntList Zero=new IntList(0,null,null);
- int get() {
- return a;
- }
- int get(int Z) {
- IntList Frag=this.copyof();
- while (Z>0) {
- Frag=Frag.getnext();
- Z--;
- }
- return Frag.get();
- }
- }
- public class ListeTest {
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- IntList L=new IntList(1);
- L.add(2);
- L.add(3);
- L.add(4);
- System.out.print(L.get());
- System.out.print(L.get(1));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement