201671010113 2016-2017-2 the 11th week of Java programming

Source: Internet
Author: User

This week past, it has been more than half of the semester, the teacher on the 1 to 8 chapters of the content of the review, do feel that the front of the things are not so difficult, although there is still a little problem, but have to say that the teacher's method is really effective. This chapter we learn the collection, and the data structure has a great connection, list is a sequential table, stack is the stack, tree is the trees. Many of the algorithms in the data structure can be implemented in Java in addition to C, unlike in C we use asc| |, which is now Unicode. The collection in JDK1.1 is not the same as it is now, with great progress. JAVA1.2 began to have a huge collection system that was used to complete various sets of operations, and this provides a powerful design solution that has solved most of the problems that we are facing in the process. Although this chapter is relatively simple, the test task is easy, but I am still a little confused in it

public static void Main (string[] args)   {   //Create SortedSet object generic variable and named parts      sortedset<item> parts = new Treeset<> ();      Parts.add (New Item ("Toaster", 1234));//Call Add to initialize the      parts.add (New Item ("Widget", 4562));      Parts.add (New Item ("Modem", 9912));      SYSTEM.OUT.PRINTLN (parts);      Create a Navigableset object generic variable, type Item, and name Sortbydescription, and the parameter calls the comparing method of comparator      navigableset<item> Sortbydescription = new Treeset<> (            comparator.comparing (item::getdescription));//implement sort function      Sortbydescription.addall (parts);//Add parts to Sortbydescription      System.out.println (sortbydescription);   }

I checked, Navigableset is a sort of reverse order, but the sorting results come out after the positive sequence, do not understand why, can explain

  

201671010113 2016-2017-2 the 11th week of Java programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.