Lambda Expressions

Does anyone have any getting started type code, without Lambda Expressions, to give me an idea of how the library works. My editor it seems does not like the code, and to be honest, I understand using them, self taught, and just cannot decode the logic. If you could point me the right direction it would be appreciated.

Example this section, I just do not get the logic, in that I do not see the Location object listed as being returned by the method.

I see a few examples here for the customer object, and I will need to design a post back once processed to generate my electronic product. Netbeans is complaining about it not being compatible above Java 8, which confuses me a little as well.

Thanks

      locationsApi.listLocationsAsync()
                .thenAccept(result -> {
                    for (Location l : result.getLocations()) {
                        System.out.printf(
                                "%s: %s, %s, %s\n",
                                l.getId(),
                                l.getName(),
                                l.getAddress().getAddressLine1(),
                                l.getAddress().getLocality());
                    }
                })
                .exceptionally(exception -> {
                    try {
                        throw exception.getCause();
                    } catch (ApiException ae) {
                        for (Error err : ae.getErrors()) {
                            System.out.println(err.getCategory());
                            System.out.println(err.getCode());
                            System.out.println(err.getDetail());
                        }
                    } catch (Throwable t) {
                        t.printStackTrace();
                    }
                    return null;
                })

Unfortunately we don’t have an example other than what’s in the docs that you’re using. Also here is the breakdown of the API call for ListLocation. :slightly_smiling_face:

Thanks, I am just trying to sort through the classes to see the logic, I am trying to figure out what this result is, seems like a ListLocationsResponse, just do not see where you initiated the result variable anywhere, so it has to be inside locationsApi somewhere.

Oh well, this is probably beyond my abilities, might have to move on to a new provider.

It’s initiated with:

locationsApi.listLocationsAsync() :slightly_smiling_face:

Ok, in this lambda notation, you are iterating through the locations by creating a new Location on each loop called l,

Location l : result.getLocations()

So I have not seen this output, and I see JSON mentioned here in your classes, so this is a XML tree object?, and the Locations are inside of a Result. I know that this is probably too basic for you, but in understanding what is happening here, this is like ABC level in learning English, in the example where is this result variable initiated?

result.getLocations(), I do not see it initiated anywhere as a object.

Ok, so there is a Java javax.xml.transform.Result, as in upper case R, is this what they are doing is intiating a Result class with a upper case R?