From 2ee19fc7464e404a295d0a5dd21e68303abef533 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Thu, 12 Apr 2018 17:05:00 +0200 Subject: [PATCH] =?UTF-8?q?aufger=C3=A4umt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../praktikum/praktikum2/CharCollection.java | 23 ------------------- .../hs/java2/tests/CharCollectionTest.java | 1 + 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/main/java/de/joethei/hs/java2/praktikum/praktikum2/CharCollection.java b/src/main/java/de/joethei/hs/java2/praktikum/praktikum2/CharCollection.java index 1e1ad55..bf0a25f 100644 --- a/src/main/java/de/joethei/hs/java2/praktikum/praktikum2/CharCollection.java +++ b/src/main/java/de/joethei/hs/java2/praktikum/praktikum2/CharCollection.java @@ -19,10 +19,6 @@ public class CharCollection implements Cloneable{ } } - private CharCollection(List list) { - this.list = list; - } - public int size() { return this.list.size(); } @@ -40,24 +36,6 @@ public class CharCollection implements Cloneable{ return set.size(); } - /* - public char top() { - if(list.size() == 0) return 0; - ArrayList test = new ArrayList<>(list); - Collections.sort(test); - int actual=0, most=0; - char top = test.get(0); - for(char c : test) { - if (top == c) { - actual++; - if (actual >= most) most = actual; top = c; - } else { - actual = 1; - } - } - return top; - } - */ public char top() { if(list.isEmpty()) return 0; int max = 0; @@ -98,7 +76,6 @@ public class CharCollection implements Cloneable{ if(removeCharacterOnce) i--; removeCharacterOnce = false; } - //System.out.println("list2: "+list2.toString()); StringBuilder s = new StringBuilder(); for(char c:list) s.append(c); return new CharCollection(s.toString()); diff --git a/src/test/java/de/joethei/hs/java2/tests/CharCollectionTest.java b/src/test/java/de/joethei/hs/java2/tests/CharCollectionTest.java index d3ccf5b..b8f47c8 100644 --- a/src/test/java/de/joethei/hs/java2/tests/CharCollectionTest.java +++ b/src/test/java/de/joethei/hs/java2/tests/CharCollectionTest.java @@ -17,6 +17,7 @@ public class CharCollectionTest { assertEquals(5, new CharCollection("Hallo").size()); } + @Test public void count() { assertEquals(2, new CharCollection("Hallo").count('l'));