Results

Most of the library calls which operate on a single entity will return an object of the appropriate type (e.g. Customer, Transaction etc) which you can consume directly.

Customer customer = gateway.customer().find("customer_uid");
// You can now use the Customer object directly

Lists

When searching for objects, or inspecting the list/array properties of objects, you will find them packed inside a Collection object.

The Collection is an useful wrapper, making the list of objects easy to use, and to allow you to perform paginated access to large number of objects (e.g. thousands of transactions).

TransactionCollection results = gateway.transaction().search(searchReq);
for (Transaction txn : results.getItems()) {
    txn.getId();
}

Using the items property you can easily iterate through the returned list of objects.