public static void invokeExample() { String s; MethodType mt; MethodHandle mh; MethodHandles.Lookup lookup = MethodHandles.lookup(); MethodType mt = MethodType.methodType(String.class, char.class, char.class); MethodHandle mh = lookup.findVirtual(String.class, "replace", mt); s = (String) mh.invokeExact("App Engine Java 6 runtime",'6','7'); System.out.println(s); }
public static void viewTable(Connection con, String query) throws SQLException { try ( Statement stmt = con.createStatement(); ResultSet rs = stmt.executeQuery(query) ) { while (rs.next()) { // process results // } } catch (SQLException e) { // con resource is auto-closed, no need to do anything here! // } }
Map> myMap = new HashMap<>();
Map> myMap = new HashMap>();
public class SuperHeroes { public List listSuperHeroes() { List list = new ArrayList(); list.add(new SuperHero ("Champion of the Obvious", "Brad Abrams")); list.add(new SuperHero ("Mr. Justice", "Chris Ramsdale")); return list; } }
}
Now you have a simple REST interface.
$ curl http://localhost:8888/_ah/api/superheroes/v1/superheroes { "items": [ { "knownAs" : "Champion of the Obvious", "realName" : "Brad Abrams" }, { "knownAs" : "Mr. Justice", "realName" : "Chris Ramsdale" }
Real result = superheroes.list().execute();
GTLQuerySuperHeroesV1 *query = [GTLQuerySuperHeroesV1 queryForSuperHeroesList]; [service executeQuery:query completionHandler:^(GTLServiceTicket *ticket, GTLSuperHeroes *object, NSError *error) { NSArray *items = [object items]; }];
// ... var ROOT = 'https://' + window.location.host + '/_ah/api'; gapi.client.load('superheroes', 'v1', loadSuperheroesCallback, ROOT); // Get the list of superheroes gapi.client.superheroes.superheroes.list().execute(function(resp) { displaySuperheroesList(resp); });
Demonstrate your proficiency to design, build and manage solutions on Google Cloud Platform.