Oct 01
I’ve been working with GWT (Google’s Web Toolkit) a bit recently, and I must first say it’s an amazing tool. It does have some downfalls, like requiring you to use J2SE 1.4 syntax, so no enum or generics when developing with GWT.. That said, there’s nothing stopping you from using the Java SE 5 or 6 framework, so concurrency and all the other goodies are still there (to be used on the server side, obviously).
And that’s just unfortunate, because I really got used to using enums! Still, not having the syntax is not going to stop me. After all, enums in Java are eventually translated into classes, so I can just write my own GWT-compatible Enum-class. Continue reading »
Sep 14
A class I find missing in the new java.util.concurrent package is PriorityBlockingDeque. Just like PriorityBlockingQueue, this class should be sorting its elements either by their natural order or by a supplied Comparator.
I fail to understand the reason for having this class obviously missing from the package, and because I need it very much, I decided to create a blocking wrapper around NavigableSet using locks and conditions. This uses NavigableSet’s already existing methods of pollFirst, pollLast, first and last to fulfil the Deque interface.
Update: After some comments appeared I’ve realised that by using NavigableSet I do not allow for duplicate values on the Deque. Therefore, I’ve changed the implementation to use LinkedList internally, using Collections.sort calls to keep the list sorted. Unfortunately, this brings the basic add operation to O(n log(n)), instead of the O(log(n)) it used to be.
The code is fully available here, as part of the collections project, and some unit tests are available here.
I will later post how I used it, but let me know if you used it and if it was of any help (or filled with bugs..)
Aug 31
A week ago, Michael Barker wrote a use case for yielder, where he uses the yielding ability to implement “Mini-Axon”, the Kamaelia learning experience usually done in Python, where generators are a built-in feature of the language. I thought it was good to mention it here, to show how yielder can be used for more than just an easy way to implement iterators – for example, to yield results of processing requests as soon as they arrive at the processing box, in the case of Mini-Axon.
Also, if you have downloaded Yielder in the past, go and download the new version which sports two new main features, one of allowing hierarchies under the Yielder class (before, your implementation had to be a direct subclass) and the second is not using debugging information at all, making the tool work with any environment as it relies solely on the bytecode itself. (If you never downloaded yielder, what are you waiting for?)