Code example for List

Methods: toArray

0
    } 
  } 
 
  @Implementation 
  public Account[] getAccounts() {
    return accounts.toArray(new Account[0]);
  } 
 
  @Implementation 
  public Account[] getAccountsByType(String type) {
    List<Account> accountsByType = new ArrayList<Account>();
 
    for (Account a : accounts) {
      if (type.equals(a.type)) {
        accountsByType.add(a);
      } 
    } 
 
    return accountsByType.toArray(new Account[0]);
  }