Faster smaller collections and maps Includes primitive keyed maps
Posts
Showing posts from 2007
Jetty XmlConfiguration
- Get link
- Other Apps
Mort Bay Consulting Jetty XmlConfiguration. O'Reill OnJava.com article Kudos to the Jetty team for taking the XML configuration one step farther: ... all Jetty-specific calls ... are element or attribute values, not names. This means the XML configuration can be used with any classes, even non-Jetty classes. Depending on how your app is written, you could configure it all through Jetty's XML config. See the references below for more details. Jetty configuration example Other Jetty configuration examples Jetty configure.dtd Jetty XmlConfiguration Jetty Java Xref try { final XmlConfiguration xconfig = new XmlConfiguration(<configUrl>); xconfig.configure(<object ref>); } catch (IOException ioe) { ... } catch (SAXException saxe) { ... } catch (Exception e) { ... } <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure 1.1//EN" "http://jetty.m
Generics
- Get link
- Other Apps
Josh Bloch Generics JavaOne 2006 Builder pattern / Static Factories klass.cast(...) Sparse Array Serialization Proxy Use private and final unless reason not Generics Considered Harmful Generics vs. Autocasting Explicitly provide type by passing in class, see bottom of page method generics public abstract void getAndParse(T paramAnotherClass); public void addFriend(String name, Class type, T animal);
Singleton: Initialize-On-Demand Holder Class idiom
- Get link
- Other Apps
Memory model article and Initialize-On-Demand Holder Class idiom Listing 2. The Initialize-On-Demand Holder Class idiom private static class LazySomethingHolder { public static Something something = new Something(); } ... public static Something getInstance() { return LazySomethingHolder.something; } This idiom derives its thread safety from the fact that operations that are part of class initialization, such as static initializers, are guaranteed to be visible to all threads that use that class, and its lazy initialization from the fact that the inner class is not loaded until some thread references one of its fields or methods.
Generic Methods
- Get link
- Other Apps
From Hibernate 3.2.0.GA AbstractEntityManagerImpl.java @SuppressWarnings("unchecked") public <A> A find(Class<A> entityClass, Object primaryKey) { ... try { return (A) getSession().get( entityClass, (Serializable) primaryKey ); } catch ... } @SuppressWarnings("unchecked") public <A> A merge(A entity) { ... try { return (A) getSession().merge( entity ); } catch ... }
Structure101
- Get link
- Other Apps
Structure101 enables visualization of software structure - architectural design and layering as well as packaging and class dependencies. It makes it easy to understand, monitor, and enforce. IDE plug-ins highlight and display layering/dependency violations as errors. Structure101 addresses the need to manage an applications architecture to keep it easier to understand and less fragile, all of which increases maintainability. I have successfully used Structure101 at two different companies and on two large scale enterprise projects. It was easy to setup and use and made identifying poor design and implementation a breeze. I was able to quickly analyze the full code bases and identify tangled and complex code. With Structure101 I could drill right down to the specific areas of the code that violated best practices so that they could be analyzed and corrected.