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