rendered paste bodypublic class LenkaListe { // Variables private LenkaNode pointer; private int count; // Constructor public LenkaListe(){ pointer = null; count = 0; } // Add public void add(int position, Object obj){ LenkaNode newNode = new LenkaNode(obj); LenkaNode current, temp; int index = 0; if(pointer == null) pointer = newNode; else{ current = pointer; if(position > 0){ while(pointer != null && index < position-1){ current = current.next; index++; } temp = current.next; current.next = pointer; pointer.next = temp; } } count++; } // Delete public void delete(int position){ if(pointer == null) return; int index = 0; LenkaNode current = pointer; if(position > 0){ while(current.next != null && index < position-1){ current = current.next; index++; } current.next = current.next.next; } else pointer = pointer.next; count--; } // Get public Object get(int position){ int index = 0; LenkaNode current = pointer; while(index != position-1){ current = current.next; index++; } return current; } // Make all null-pointer public void makeNull(){ LenkaNode current = pointer; while(count != 0){ if(current != null){ current = null; current = current.next; count--; } else current = current.next; } } // LenkaNode-class private class LenkaNode{ public Object obj; public LenkaNode next; public LenkaNode(Object obj){ this.obj = obj; next = null; } }}