Skip to content

Commit

Permalink
Add new constructor for AccoutInfo, use Iterable<Wallet> as parameter…
Browse files Browse the repository at this point in the history
… instead.
  • Loading branch information
sutra committed Apr 10, 2015
1 parent 430af3e commit 135dd90
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ public AccountInfo(String username, List<Wallet> wallets) {
this(username, null, wallets);
}

/**
* @see #AccountInfo(String, BigDecimal, Iterable).
*/
public AccountInfo(String username, Iterable<Wallet> wallets) {
this(username, null, wallets);
}

/**
* @see #AccountInfo(String, BigDecimal, Map).
*/
Expand Down Expand Up @@ -71,6 +78,24 @@ public AccountInfo(String username, BigDecimal tradingFee, List<Wallet> wallets)
}
}

/**
* Constructs an {@link AccountInfo}.
*
* @param username the user name.
* @param tradingFee the trading fee.
* @param wallets the wallets, the currencies of the wallets should not be duplicated.
*/
public AccountInfo(String username, BigDecimal tradingFee, Iterable<Wallet> wallets) {
this.username = username;
this.tradingFee = tradingFee;
this.wallets = new ArrayList<Wallet>();
this.walletsMap = new HashMap<String, Wallet>();
for (Wallet wallet : wallets) {
this.wallets.add(wallet);
this.walletsMap.put(wallet.getCurrency(), wallet);
}
}

/**
* Constructs an {@link AccountInfo}.
*
Expand Down

0 comments on commit 135dd90

Please sign in to comment.