Template:Collection/doc

From Wikiversity
Jump to navigation Jump to search
Edit-paste.svg
This is the template documentation page for {{Collection}}.
It is not necessarily intended to be viewed directly. If it uses variables, some links may appear broken. Do not replace these variables with hardcoded page names or URLs.

An infobox for Java collections.

Syntax[edit]

All parameters are required.

  • name — The name of the collection. Automatically put in a monospace font by the template.
  • ordered — Whether the collection is ordered
  • access — Whether the collection is random-access (Random), LIFO (FILO), FIFO, etc..
  • key — How elements are retrieved. "Index" is appropriate for msot subinterfaces of Collection; lists should use "Iterator"; "Object" should be used for maps.
  • duplicates — Whether duplicate elements are allowed
  • impl — Standard implementation(s) of the collection. Not automatically put in monospace by the template; this should be done manually with the {{code}} template.

An additional parameter, type, specifies whether the collection is an interface or implementation (class); however, it is optional and defaults to Interface.