background preloader

Api

Facebook Twitter

Google

Howto. Json. Graphs. Ssh. Timeline. Google Collections: A Quick Overview — Matthias' Articles. Google Collections is a library complementing Java’s Collections Framework.

Google Collections: A Quick Overview — Matthias' Articles

It adds new collection types not present in the JDK and provides lots of static factory methods and utilities that simplify Java development, making the code more concise and readable. In contrast to commons-collections, Google Collections is targeted at JDK 1.5 and makes full use of generics. After about four years of development, Google Collections has recently reached version 1.0 and is already used extensively in Google’s products.

The library is released under the Apache License 2.0. This article gives a quick introduction with lots of links to the Javadocs where you should find the answers to all of your questions. Maven Integration Add the following dependency to your POM: Immutable Collections Google Collections offers specialized immutable collections (ImmutableCollection et al) that are safe, high performance, and easy to use. This only works for up to five mappings. Multisets (aka Bags) Multimaps BiMap. Datejs - A JavaScript Date Library. API Design vs. API Usability. I took last week off to work on some Wicket web programming - seeing as my day-job is desktop programming (and also as a hedge against ending up jobless after Oracle buys Sun).

API Design vs. API Usability

I've done a lot of talks on API design, focusing on how to not "paint yourself into a corner" in terms of backward compatibility. There is a complementary subject - API usability, that deserves equal consideration. But reconciling the two is a hard problem. What defines a "usable" API is set more by the expectations of the users of that API - and that depends on their conception of how libraries are supposed to work - which is often at odds with how to actually make something you will be able to change in the future without breaking existing users' code.

I can spell out how to create an API that you can change in the future without breaking backward compatibility with a few simple rules: Make all classes final unless there are at least two clear use-cases for subclassing. public final class com . foo . api . And List. Duckprxy. What is it Duck typing is a style of dynamic typing where the type of an object is determined by its set of methods rather than by a defined class it belongs to.

duckprxy

Java does not allow duck typing out of the box. This library helps to overcome this limitation. Given an arbitrary object and an interface, this library lets you get an object that implements the interface by delegating to the object. Project Site More information can be found in the duckprxy project's site (generated with Maven). Example Let us assume we have to implement an interface (MyInterface), but only want to implement the method bar(), because the other methods will not be called. Interface MyInterface { void foo(); int bar(int x, int y); int baz(int x); } public class Delegate { public int bar() { return 42; } }

The true raconteur and I ain’t talking about Feynman! Feynman has often been described as a raconteur and I am sure he deserves that epithet without me justifying it or otherwise.

The true raconteur and I ain’t talking about Feynman!

The reason he was called so was because of his extremely direct manner of explaining, in the simplest of terms, some of the most complex concepts of advanced physics. His video lecture series was one of those myriad events which further reinforced his stature as a clear-headed genius. Now, that is not as trivial as it may seem at first.