Collections

From Computer Science Wiki
Jump to: navigation, search
Programming basics[1]

A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit. Collections are used to store, retrieve, manipulate, and communicate aggregate data. Typically, they represent data items that form a natural group, such as a poker hand (a collection of cards), a mail folder (a collection of letters), or a telephone directory (a mapping of names to phone numbers). If you have used the Java programming language — or just about any other programming language — you are already familiar with collections.[2]

Collection methods

Collection methods in Pseudocodean informal high-level description of the operating principle of a computer program or other algorithm. are:[3]

  • .addItem( new data item )
  • .resetNext( ) start at beginning of listGive a sequence of brief answers with no explanation.
  • .hasNext( ) checks whether there are still more items in the listGive a sequence of brief answers with no explanation.
  • .getNext( ) retrieve the next item in the listGive a sequence of brief answers with no explanation.
  • .isEmpty( ) check whether the listGive a sequence of brief answers with no explanation. is empty

Write, in pseudocode, a collection that adds the first names of everyone in the class. You then must find the name of everyone whose name starts with M.


Do you understand this?

Standards

  • DescribeGive a detailed account or picture of a situation, event, pattern or process. the characteristics and applications of a collection.
  • ConstructDevelop information in a diagrammatic or logical form. algorithms using the access methods of a collection.
  • DiscussOffer a considered and balanced review that includes a range of arguments, factors or hypotheses. Opinions or conclusions should be presented clearly and supported by appropriate evidence. the need for sub-programmes and collections within programmed solutions.
  • ConstructDevelop information in a diagrammatic or logical form. algorithms using pre-defined sub-programmes, one-dimensional arrays and/or collections.

References