Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new ArrayList<X>
- Collections.emptyList();
- interface Configurable {
- List<String> getConfigurationList();
- }
- // class which doesn't have any configuration
- class SimpleConfigurable extends Configurable {
- public List<String> getConfigurationList() { return Collections.emptyList(); }
- }
- /**
- * Returns the empty list (immutable). This list is serializable.
- *
- * <p>This example illustrates the type-safe way to obtain an empty list:
- * <pre>
- * List<String> s = Collections.emptyList();
- * </pre>
- * Implementation note: Implementations of this method need not
- * create a separate <tt>List</tt> object for each call. Using this
- * method is likely to have comparable cost to using the like-named
- * field. (Unlike this method, the field does not provide type safety.)
- *
- * @see #EMPTY_LIST
- * @since 1.5
- */
Add Comment
Please, Sign In to add comment