Also, dass funkioniert nur dann, wenn ich einstellige Ziffer eingebe, aber wenn ich zweistellige Ziffer eingebe, dann klappt es leider nicht, Wenn jemand mir Hinweise geben könnte, würde mir sehr geholfen
public void add(int value) {
LinkedListElement newValue = new LinkedListElement();
newValue.setValue(value);
if(start == null) {
start = newValue;
current = newValue;
}else if(newValue.getValue() <= start.getValue()) {
newValue.setNext(start);
start = newValue;
}else {
LinkedListElement tmp = start;
while(tmp.getNext() != null && newValue.getValue() < tmp.getValue()) {
tmp = tmp.getNext();
}
if(tmp.getValue() != null) {
newValue.setNext(tmp.getNext());
}
tmp.setNext(newValue);
}
}
public void show()
{
LinkedListElement gela = start;
while (gela != null)
{
System.out.print(gela.getValue() + " ");
gela = gela.getNext();
}
}
public void add(int value) {
LinkedListElement newValue = new LinkedListElement();
newValue.setValue(value);
if(start == null) {
start = newValue;
current = newValue;
}else if(newValue.getValue() <= start.getValue()) {
newValue.setNext(start);
start = newValue;
}else {
LinkedListElement tmp = start;
while(tmp.getNext() != null && newValue.getValue() < tmp.getValue()) {
tmp = tmp.getNext();
}
if(tmp.getValue() != null) {
newValue.setNext(tmp.getNext());
}
tmp.setNext(newValue);
}
}
public void show()
{
LinkedListElement gela = start;
while (gela != null)
{
System.out.print(gela.getValue() + " ");
gela = gela.getNext();
}
}