forked from hummel/Bank-System
Compare commits
No commits in common. "treesetExample" and "main" have entirely different histories.
treesetExa
...
main
|
@ -2,7 +2,6 @@ package de.hs_mannheim.informatik.bank.domain;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class Bank implements Serializable {
|
||||
|
|
|
@ -3,7 +3,7 @@ package de.hs_mannheim.informatik.bank.domain;
|
|||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Konto implements Serializable, Comparable {
|
||||
public class Konto implements Serializable {
|
||||
private int nummer;
|
||||
protected long stand = 0;
|
||||
private String inhaber;
|
||||
|
@ -23,7 +23,7 @@ public class Konto implements Serializable, Comparable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Konto "+ stand + "[nummer=" + nummer + ", inhaber=" + inhaber + "]";
|
||||
return "Konto [nummer=" + nummer + ", inhaber=" + inhaber + "]";
|
||||
}
|
||||
|
||||
public String getInhaber() {
|
||||
|
@ -73,12 +73,4 @@ public class Konto implements Serializable, Comparable {
|
|||
return saldo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Object other) {
|
||||
Konto kOther = (Konto) other;
|
||||
|
||||
// return (int) (this.stand - kOther.stand);
|
||||
return this.inhaber.compareTo(kOther.inhaber);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
package de.hs_mannheim.informatik.bank.facade;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import de.hs_mannheim.informatik.bank.domain.Bank;
|
||||
import de.hs_mannheim.informatik.bank.domain.Girokonto;
|
||||
|
@ -30,15 +27,10 @@ public class Banksystem {
|
|||
|
||||
public String[] getKontenliste() {
|
||||
Collection<Konto> konten = bank.getKontenliste();
|
||||
|
||||
|
||||
TreeSet<Konto> ts = new TreeSet<>(konten);
|
||||
|
||||
|
||||
String[] liste = new String[konten.size()];
|
||||
|
||||
int i = 0;
|
||||
for (Konto k : ts) {
|
||||
for (Konto k : konten) {
|
||||
liste[i++] = k.toString();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue