diff --git a/AuD/.idea/.gitignore b/AuD/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/AuD/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/AuD/src/UEB03/Liste.java b/AuD/src/UEB03/Liste.java index 30c9d31..e016864 100644 --- a/AuD/src/UEB03/Liste.java +++ b/AuD/src/UEB03/Liste.java @@ -180,10 +180,25 @@ public class Liste public int entferneWerte(final T opfer) { int anzGeloeschte = 0; + Link currentLink = anfang; + Link before = new Link(null,null); - // Diese Methode wird im Praktikum implementiert - // TODO - + while ((currentLink != null)) + { + if(currentLink.daten.equals(opfer)){ + if(currentLink == anfang){ + anfang = currentLink.naechster; + }else if(currentLink == ende) { + before.naechster = null; + ende = before; + }else { + before.naechster = currentLink.naechster; + } + anzGeloeschte++; + } + before = currentLink; + currentLink = currentLink.naechster; + } return anzGeloeschte; } } \ No newline at end of file diff --git a/out/production/AuD/UEB03/Liste.class b/out/production/AuD/UEB03/Liste.class index f6e168f..b5a8d2d 100644 Binary files a/out/production/AuD/UEB03/Liste.class and b/out/production/AuD/UEB03/Liste.class differ