Last active
December 10, 2015 17:38
-
-
Save eitany/4468506 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SQLQuery<Quote> priceQuery = new SQLQuery<Quote>("region = ?").setProjections("price").setParameter(1, "new-york"); | |
| GSIterator priceIterator = gigaSpace.iterator().addTemplate(priceQuery).create(); | |
| int count = 0; | |
| double priceSum = 0; | |
| for(Quote quote : priceIterator){ | |
| count++; | |
| priceSum += quote.getPrice(); | |
| } | |
| //Calculate region of quotes average price. | |
| double average = priceSum / count; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment