Initial sharing of project
commit
647b940584
|
@ -0,0 +1,73 @@
|
|||
|
||||
|
||||
public class List<T>
|
||||
{
|
||||
private Node<T> first;
|
||||
|
||||
public List()
|
||||
{
|
||||
first = null;
|
||||
}
|
||||
public boolean isEmpty()
|
||||
{
|
||||
if(first == null) return true;
|
||||
return false;
|
||||
}
|
||||
public int size()
|
||||
{
|
||||
Node<T> current = first;
|
||||
int count = 0;
|
||||
|
||||
while(current != null)
|
||||
{
|
||||
count ++;
|
||||
current = current.next;
|
||||
}
|
||||
return current;
|
||||
}
|
||||
public void add(T val)
|
||||
{
|
||||
Node<T> current = first;
|
||||
|
||||
for(int i = 0;i < n;i++)
|
||||
{
|
||||
if(current == null) return null;
|
||||
current = current.next;
|
||||
}
|
||||
if(current == null) return null;
|
||||
return current.wert;
|
||||
}
|
||||
public void add(int n, T val)
|
||||
{
|
||||
Node<T> neu = new Node<T>();
|
||||
neu.wert = val;
|
||||
|
||||
Node<T> current = first;
|
||||
|
||||
if(first == null)
|
||||
{
|
||||
first = neu;
|
||||
} else{
|
||||
while(current.next == null)
|
||||
{
|
||||
current = current.next;
|
||||
}
|
||||
current.next = neu;
|
||||
}
|
||||
}
|
||||
public boolean contains(T val)
|
||||
{
|
||||
Node<T> current = first;
|
||||
|
||||
while(current != null)
|
||||
{
|
||||
if(current.wert.equals(val)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public T remove(int n)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
public class Node<T>
|
||||
{
|
||||
public T wert;
|
||||
public Node<T> next;
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
------------------------------------------------------------------------
|
||||
Dies ist die README-Datei des Projekts. Hier sollten Sie Ihr Projekt
|
||||
beschreiben.
|
||||
Erzählen Sie dem Leser (jemand, der nichts über dieses Projekt weiss),
|
||||
alles, was er/sie wissen muss. Üblicherweise sollte der Kommentar
|
||||
zumindest die folgenden Angaben umfassen:
|
||||
------------------------------------------------------------------------
|
||||
|
||||
PROJEKTBEZEICHNUNG:
|
||||
PROJEKTZWECK:
|
||||
VERSION oder DATUM:
|
||||
WIE IST DAS PROJEKT ZU STARTEN:
|
||||
AUTOR(EN):
|
||||
BENUTZERHINWEISE:
|
|
@ -0,0 +1,42 @@
|
|||
#BlueJ package file
|
||||
dependency1.from=List
|
||||
dependency1.to=Node
|
||||
dependency1.type=UsesDependency
|
||||
editor.fx.0.height=0
|
||||
editor.fx.0.width=0
|
||||
editor.fx.0.x=0
|
||||
editor.fx.0.y=0
|
||||
objectbench.height=100
|
||||
objectbench.width=776
|
||||
package.divider.horizontal=0.6
|
||||
package.divider.vertical=0.8003731343283582
|
||||
package.editor.height=422
|
||||
package.editor.width=661
|
||||
package.editor.x=304
|
||||
package.editor.y=42
|
||||
package.frame.height=600
|
||||
package.frame.width=800
|
||||
package.numDependencies=1
|
||||
package.numTargets=2
|
||||
package.showExtends=true
|
||||
package.showUses=true
|
||||
project.charset=UTF-8
|
||||
readme.height=60
|
||||
readme.name=@README
|
||||
readme.width=48
|
||||
readme.x=10
|
||||
readme.y=10
|
||||
target1.height=70
|
||||
target1.name=Node
|
||||
target1.showInterface=false
|
||||
target1.type=ClassTarget
|
||||
target1.width=120
|
||||
target1.x=10
|
||||
target1.y=90
|
||||
target2.height=70
|
||||
target2.name=List
|
||||
target2.showInterface=false
|
||||
target2.type=ClassTarget
|
||||
target2.width=120
|
||||
target2.x=70
|
||||
target2.y=10
|
Loading…
Reference in New Issue