201621123013 Java Programming 9th Week of study summary

Source: Internet
Author: User
Tags set time

1. This week study summary 1.1 summarizes the set and generic related content in the way you like (mind map or other).

2. Written work of this job title set collection 1. The deletion of the specified element in list (topic set) 1.1 Experimental summary. and answer: List at least 2 ways to delete elements in the list.

A: In the first function, the convertStringToList function directly divides the Scanner sc = new Scanner(line); line string into small segments directly (before the teacher does, the usual split methods are stored in the array and then subsequently manipulated). Another is the second function to do a forward traversal, and then remove the str character (using remove() the method), there is a note to pay attention to the deletion of elements, I change (i--)!!!

Method 1:

Method 2 (use iterator iterator):

2. Count the number of words in the text and sort by the number of occurrences (title of the topic) 2.1 Pseudo-code (not copy code, otherwise deducted)

For:

1, create a treemap, Map<String(Key),Integer(value)> dict ,key--> word,vlaue--> occurrences.

2, using the above function of the sentence useful to Scanner linescanner = new Scanner(words); split the operation.

3, next determine whether the word exists in the dict inside, if it does not exist, it will join, ( put ), and its vlaue is assigned to 1. If it already exists, the Vlaue value of the operation is +1. The whole operation down, end, print the number of words.

4. Next, create a list object,
List<Entry<String,Integer>> list = new ArrayList<Entry<String,Integer>>(dict.entrySet());Then the Collections.sort list object is sorted by method, and the sort method needs to be rewritten--first by value, if the value is equal, then the key is compared, which is the alphabetical order.

5, the last is the output map.

2.2 Experimental Summary

A: The main thing is about the creation of the list object, the first time to use, will be more unfamiliar, do not understand, need to ask classmates, there is a Collections.sort() sort, the ordering method needs to pay attention to the ordering requirements, to write.

3. Inverted index (problem set) the subject is more difficult, do not come out of the matter. But must have own thinking process, must have the submission result. 3.1 Your code runs the result

For:

3.2 pseudocode (Do not copy code, otherwise deduct)

For:

1. First create the Map object Word, where the key and value are the word (String) and the number of lines corresponding to the word (ArrayList), and then create a ArrayList object.

2, next read the article operation, set conditions, if to "!!!!! "Just quit, otherwise, it's like the number of words added to the previous question." If Word already has the corresponding key, then it is necessary to determine whether the current number of the corresponding key is in its own value, if none, add it; if there is no corresponding key in Word, it is easier to add the word to Word and add the corresponding number of rows to value.

3. Traverse the corresponding map in the output word.

4, then enter the element we want to find (each line of string separated by a space), to compare, if not exist on the print statement "found 0 results", if present, the corresponding key to find the corresponding Vlaue value (number of rows), the output.

3.3 Experimental Summary

A: The difficulty is a bit big, do a good job, that is, this part of the new content mastery is not very clear, some grammar also have a lot of do not understand the place, this kind of topic is also less do, but fortunately, I go to ask classmates, to my careful talk about its way of thinking, only to understand this problem, reflect on their own

4.Stream and Lambda write a student class with the properties: private Long id;`` private String name;`` private int age;`` private Gender gender;//枚举类型`` private boolean joinsACM;//是否参加过ACM比赛创建一集合对象, such as List4.1 using traditional methods to write a search method list

For:

4.2 Use the stream () in Java8, filter (), collect () to write the code with the same 4.1, and test (to show the test data). When building a test collection, in addition to the normal student object, add some null to the collection, and the method you write should handle the null instead of throwing an exception. (: The school number appears)

For:

5. Generic class: Code for the GeneralStack5.1 Generalstack interface of the Generalstack set jmu-java-05-collection

For:

5.2 What are the benefits of generics compared to arraylistintegerstack in previous assignments?

A: In the previous job ArrayListIntegerStack , some of the methods (out of the stack, into the stack) we are defined as the Integer type, which requires that we can only Integer manipulate the type object, if the string type, it can not be manipulated, which reflects its limitations of the place, The problem is that we don't have to use generics to solve the limitations of the type. As mentioned in the previous summary, generics are allowed to specify the types of elements in the collection (don't worry about the risk of type-strong), and will report errors at compile-time.

3. Code Cloud and PTA topic set: jmu-java-05-Collection 3.1. Codes Cloud code submission is recorded in the Code cloud Project, select "Statistics-commits history-set time period", then search and

3.2 PTA Problem Set completion diagram needs to have two pictures (1. Ranking chart. 2.PTA Submission list diagram)

3.3 Statistics The amount of code completed this week requires that the weekly code statistics be fused into a single table.
Week Time Total code Amount New Code Volume total number of files number of new files
2 0 0 0 0
3 235 235 6 6
5 498 263 13 7
6 711 213 19 6
7 1237 526 30 11
8 1670 433 43 13
9 2352 682 61 18
4. Evaluate your understanding of Java try to evaluate your understanding of Java from the following dimensions
Dimension of degree
Grammar PTA Some problems, through learning to ask the ability of students can also basically complete
Object-oriented design capabilities There is a lack of capacity in this area, and there is great room for progress.
Application capabilities Feel the foundation to play well, feel what you have learned now is a few very shallow things
Number of code lines to date 2352

201621123013 Java Programming 9th Week of study summary

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.