mach ma
This commit is contained in:
parent
d3984e7024
commit
3416cfadda
@ -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<intZahl.length(); w++) {
|
||||
Zahl[w] = Integer.parseInt(String.valueOf(intZahl.charAt(w)));
|
||||
}
|
||||
this(Integer.toString(i));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -41,7 +37,7 @@ public class GrosseZahl {
|
||||
public boolean less(GrosseZahl b) {
|
||||
if(this.Zahl.length < b.Zahl.length) return true;
|
||||
if(this.Zahl.length > b.Zahl.length) return false;
|
||||
if(this.equals(b)) return false;
|
||||
//if(this.equals(b)) return false;
|
||||
for(int i=0; i<this.Zahl.length; i++) {
|
||||
if(this.Zahl[i] > b.Zahl[i]) return false;
|
||||
if(this.Zahl[i] < b.Zahl[i]) return true;
|
||||
|
@ -5,18 +5,19 @@ import java.util.*;
|
||||
public class CharCollection {
|
||||
ArrayList<Character> 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<Character> set = (Set<Character>) this.list;
|
||||
return set.size();
|
||||
}
|
||||
|
||||
/*public char top() {
|
||||
if(list.size() == 0) return 0;
|
||||
|
||||
}*/
|
||||
|
||||
public String toString() {
|
||||
return list.toString();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user