
GS Collections and Java 8: Functional, Fluent, Friendly, and Fun
Goldman Sachs has supplied an extension on the collections framework already for ten years called GS collections. In java 7 they already supplied sort of lambda expressions inspired on Smalltalk lambda expressions. The speaker Donald Raab has been involved in the lambda expressions for Java 8 and have upgraded the GS collections framework to compete with the Java 8 lambda functionality. They distinguish their library on the following points:
- Java 8 has by default lazy evaluation while GS collections has eager evaluation as default, but in GS collections you can also specify lazy initialization. So you have a choice between eager and lazy evaluation
- Java 8 Collections come basically with the same collections as are available in Java 7. GS collections add Hashmaps, Multimaps, Bags in Readable, Mutable and Immutable forms.
- Java 8 has primitive collections for int, double and long. GS collections have primitive collections for any combination of primitives. For example there is a PrimitiveIntDoubleMap saying that the key has primitive type int and value has type double. Mostly these collections improve on memory footprint.
- New implemention of maps omitting the Entry object inside maps improving the memory footprint in HashMaps and HashSets. However, using the
entrySetmethod has impact on performance. Instead you should use aforEachmethod - Because of the special definitions of collections, some convenience constructs for grouping, summing and partitioning can be created that result in less statements compared to Java 8.
GS collection is open source and the source and training (Kata) can be found on GitHub
Conclusion: Java 8 and Lambda’s is very nice, but GS Collections has a lot more (See image below). GS Collections is even more then the sum of its rivals (Java 8, Guave, Trove and Scala)
Developing On-Device Java Mobile Apps for iOS…and Android Too
Shay Shmeltzer a representative of Oracle talks about the Oracle MAF framework. In essence they have created a JVM on both the iOS and android platforms, such that you can run a java application natively. Like most hybrid mobile frameworks, you can also use HTML5 and JavaScript to create your app.
An application using Oracle MAF must be created using the MVC pattern with a JSF like view. Custom UI elements can be created using apache Cordova (using HTML and JavaScript). For the eclipse and Jdeveloper IDE’s they have created plugins to make it easy to create an Oracle MAF application. A nice touch is the visual page flow designer.
Although the concepts and ideas are good, it has some downsides:
- First of all, it is not free or open source and therefore not in the mindset of most java developers.
- Secondly as a passionate open source guy and Java enthusiast, I get the feeling you are forced to use oracle UI components. While the framework probably supplies a lot of nice components, it is hard to customize it. As an architect, I like that it enables customization and collaboration with other Java libraries rather than that it limits your option. In my perspective Oracle MAF forces the user to mostly use Oracle components and is therefore a limiting framework (leaving a nasty taste for me personally)
- The ME variant of the Java 1.4 spec can only be used. So back to the stone age when writing code for Oracle MAF.
Java Performance Is an (anti) Social Activity
Javaone champion Ben Evans gave the best talk this JavaOne yet pointing out social anti-patterns in the are of Java Perfomance and performance testing. The amount of sensible and right to the point statements was immense. If he would give a workshop or course, count me in. He interacted with the audience as well making it a dynamic session. Additionally he elaborated about ranging subjects like business aspects, assumptions, testing environment, JVM configuration, etc.
Performance testing is most of the time seen as a secondary activity. This originates from how people do things.
First come Remembering, understanding and applying. Performance testing/improving comes in the Analyzing, evaluating and creating phases as we do things.
Generally there are two types of performance problems:
- Outage (Complete loss of service)
- User experience degradation
Whether such problems are real problems for the application depends greatly on context, so the concept of “understanding your business” is crucial. If you have identified the quantifiable impact a performance problem has, you have a business case.
In most cases an outage or user experience degradation costs a lot of money. It would cost significantly less if you would execute performance tests from the start. However, you should watch out for incorrect tests and possibly unmeasured root cause assumptions when evaluating these tests. Anti patterns like “Blame the donkey”, “UAT is my desktop”, “Production-like data is too hard”, “Fiddle with JVM switches”, “Tuning by folklore”, “Micro-analysis”, “Throw over the wall mentality” should be addressed (see below image).
In short to address these anti patterns you should test, measure, analyze, discuss and repeat the former steps. In doing this, it is crucial to include any expert group that you have that is involved in the runtime of the system that you are testing (This includes that you have to have an overview of the system architecture).



