Skip to content

VidyaSource/comparison-shopping

Repository files navigation

Vidya Tutorial: Comparison Shopping

Description

These are the files that accompany the Vidya video tutorial Comparison Shopping on how to use Comparable and Comparator to sort collections in Java.

Intended Audience

This tutorial is for intermediate-level Java developers who want to add comparison and sorting capabilities to the custom classes they’ve created for their projects.

Instructions

Just download the files and view them in your favorite editor. Follow along with the tutorial video, or play with the code yourself to try different ideas.

Although not strictly necessary for the focus of this tutorial, you do need Java 7 running on your machine for the code to work out of the box. If you insist on running with Java 5 or 6, modify the first line of the main method in ComparisonShopper.java to replace the diamond with the more verbose generics collection instantiation.

To compile and run the code, you can do any of the following:

  • If you have Gradle installed, either get your IDE to execute the gradle command or do it yourself by navigating to the top-level directory and simply typing "gradle" at the prompt.
  • Import the code into your IDE and run main() in ComparisonShopper.
  • If you are really hardcore, compile and run manually as described by Oracle.

Questions?

If you have questions, please check out the Vidya website or E-mail us.

Or you can find us pretty much everywhere:

We would even do Pintrest if we thought it would help.

About

These are the files that accompany the Vidya video tutorial Comparison Shopping on how to use Comparable and Comparator to sort collections in Java.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages