Weiter
parent
2f75788e3d
commit
eede5fc2d2
|
@ -11,6 +11,18 @@ public class Finanzanalyse {
|
||||||
public static void main(String[] args) throws FileNotFoundException {
|
public static void main(String[] args) throws FileNotFoundException {
|
||||||
Finanzanalyse f = new Finanzanalyse();
|
Finanzanalyse f = new Finanzanalyse();
|
||||||
f.addTran();
|
f.addTran();
|
||||||
|
|
||||||
|
//Eine gefilterte Liste mit allen Überweisungen in einer bestimmten Währung.
|
||||||
|
f.getTran().stream()
|
||||||
|
.filter(w -> w.getCurrency().equalsIgnoreCase("EUR"))
|
||||||
|
.forEach(System.out::println);
|
||||||
|
|
||||||
|
|
||||||
|
//Gesamtsumme der Überweisungen in den jeweiligen Währungen.
|
||||||
|
long usdÜberwei = f.getTran().stream()
|
||||||
|
.filter(w -> w.getCurrency().equals("USD"))
|
||||||
|
.count();
|
||||||
|
System.out.println(usdÜberwei);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArrayList<Transaction> tran = new ArrayList<>();
|
private ArrayList<Transaction> tran = new ArrayList<>();
|
||||||
|
@ -31,4 +43,10 @@ public class Finanzanalyse {
|
||||||
scan.close();
|
scan.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<Transaction> getTran() {
|
||||||
|
return tran;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,13 @@ package streams.Finanzanalyse;
|
||||||
|
|
||||||
public class Transaction {
|
public class Transaction {
|
||||||
|
|
||||||
private String sender_name;
|
private String sender_name; //absenderName
|
||||||
private String sender_account;
|
private String sender_account; //absenderKonto
|
||||||
private String receiver_name;
|
private String receiver_name; //empfaengerName
|
||||||
private String receiver_account;
|
private String receiver_account; //empfaengerKonto
|
||||||
private double amount;
|
private double amount; //betrag
|
||||||
private String currency;
|
private String currency; //waehrung
|
||||||
private String receiver_Country;
|
private String receiver_Country; //empfaengerLand
|
||||||
|
|
||||||
public Transaction(String sender_name, String sender_account, String receiver_name, String receiver_account,
|
public Transaction(String sender_name, String sender_account, String receiver_name, String receiver_account,
|
||||||
double amount, String currency, String receiver_Country) {
|
double amount, String currency, String receiver_Country) {
|
||||||
|
|
Loading…
Reference in New Issue