diff --git a/src/main/java/de/joethei/hs/java2/praktikum/praktikum1/GrosseZahl.java b/src/main/java/de/joethei/hs/java2/praktikum/praktikum1/GrosseZahl.java index defaa3e..fbfa344 100644 --- a/src/main/java/de/joethei/hs/java2/praktikum/praktikum1/GrosseZahl.java +++ b/src/main/java/de/joethei/hs/java2/praktikum/praktikum1/GrosseZahl.java @@ -22,11 +22,7 @@ public class GrosseZahl { } public GrosseZahl(int i) { - String intZahl = Integer.toString(i); - Zahl = new int[intZahl.length()]; - for(int w=0; w b.Zahl.length) return false; - if(this.equals(b)) return false; + //if(this.equals(b)) return false; for(int i=0; i b.Zahl[i]) return false; if(this.Zahl[i] < b.Zahl[i]) return true; 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 f695d1b..753a973 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 @@ -5,18 +5,19 @@ import java.util.*; public class CharCollection { ArrayList list = new ArrayList<>(); - CharCollection(char... cc) { + public CharCollection(char... cc) { for(char c:cc) this.list.add(c); } - CharCollection(String s) { + public CharCollection(String s) { new CharCollection(s.toCharArray()); } - int size() { + public int size() { return this.list.size(); } - int count(char c) { + + public int count(char c) { int rueckgabe = 0; for(char b:list) { if(b == c)rueckgabe ++; @@ -24,4 +25,25 @@ public class CharCollection { return rueckgabe; } + @Override + public boolean equals(Object o) { + if(o instanceof CharCollection) { + CharCollection c = (CharCollection) o; + return this.list.equals(c.list); + }return false; + } + + public int different() { + Set set = (Set) this.list; + return set.size(); + } + + /*public char top() { + if(list.size() == 0) return 0; + + }*/ + + public String toString() { + return list.toString(); + } } \ No newline at end of file