Code Monkey home page Code Monkey logo

5d_generictypes's Introduction

generic types

exercises in using classes that are parameterized with generic types

For each item in this section, find exemplifying code in the Pair example.

For easy reference in the future, take advantage of GitHub's "Copy permalink" command: click on a line number, then click on the resulting ellipsis. Use the permalink as the URL in GitHub-Flavored Markdown.

  • (an example of this task) the declaration of a main method:
public static void main(String[] args)

in UserSavedByCompiler

  • definition that a class / type that is parameterized by a generic type, T:
your exemplifying line from the Pair example here

in UserOfPair

  • declaration of a variable that can hold a reference to an instance of such a class:
your exemplifying line from the Pair example here

in Pair

  • assignment to such a variable:
your exemplifying line from the Pair example here

in UserOfPair

  • declaration of a method that returns an instance of such a type:
your exemplifying line from the Pair example here

in Pair

  • successful instantiation of an instance of such a class:
your exemplifying line from the Pair example here

in UserOfPair

  • unsuccessful instantiation of an instance of such a class, caught by the compiler:
your exemplifying line from the Pair example here

in UserSavedByCompiler

  • a variable that can hold a reference to an instance of the generic type in a class / type that is parameterized by a generic type:
your exemplifying line from the Pair example here

in Pair

  • the declaration of a method or constructor that accepts a parameter of a generic type:
your exemplifying line from the Pair example here

in Pair

  • the declaration of a method that returns a value of a generic type:
your exemplifying line from the Pair example here

in Pair

5d_generictypes's People

Contributors

amy-lei avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.