Guest User

Untitled

a guest
Jan 20th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. new ArrayList<X>
  2.  
  3. Collections.emptyList();
  4.  
  5. interface Configurable {
  6. List<String> getConfigurationList();
  7. }
  8.  
  9. // class which doesn't have any configuration
  10. class SimpleConfigurable extends Configurable {
  11. public List<String> getConfigurationList() { return Collections.emptyList(); }
  12. }
  13.  
  14. /**
  15. * Returns the empty list (immutable). This list is serializable.
  16. *
  17. * <p>This example illustrates the type-safe way to obtain an empty list:
  18. * <pre>
  19. * List<String> s = Collections.emptyList();
  20. * </pre>
  21. * Implementation note: Implementations of this method need not
  22. * create a separate <tt>List</tt> object for each call. Using this
  23. * method is likely to have comparable cost to using the like-named
  24. * field. (Unlike this method, the field does not provide type safety.)
  25. *
  26. * @see #EMPTY_LIST
  27. * @since 1.5
  28. */
Add Comment
Please, Sign In to add comment