201621123030 Java Programming 9th Week of study summary

Source: Internet
Author: User

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

Collection of this homework question set

1. Deletion of the specified element in the list (title of the topic)

1.1 Experimental summary. and answer: List at least 2 ways to delete elements in the list.

Experiment Summary: The Convertstringtolist function separates the input line string into a space and returns it to the dynamic array. The Remove function is a loop-read array that removes the duplicate values.

At first I did not know that split can ignore multiple whitespace-written code:

After:

Methods for deleting elements in list: 1. Use the Remove method of the list. 2. Use the Remove method of the iterator iterator.

2. Count the number of words in the text and sort them by the number of occurrences (problem set)

2.1 pseudocode (Do not copy code, otherwise deduct)

while (! ="!!!!!" The loop reads the word into the array list.End Create TreeMap ObjectMapFor If the elements of the List if array are in the map, the value   of the key corresponding to the number plus 1 Else key is an element word,value is 1 put  Map End creates list<map.entry<String,integer>> object List and saves the map to the print the length of the map is collections. Sort () list custom sorts the first 10 digits of the print List            

2.2 Experimental Summary

Map overwrites the values originally in the map when adding elements of the same key value to it, and records them by overwriting them when the number of words is entered.

3. Inverted index (problem set)

The subject is more difficult, do not come out does not matter. But must have own thinking process, must have the submission result.
3.1 Your code runs the result

3.2 pseudocode (Do not copy code, otherwise deduct)

Create ArrayList object List,list1,list2while (! ="!!!!!" ) loops through a string of strings to the list in a space-saving interval to List1End Create TreeSet ObjectSet, deposit the List1 into which the list1 is emptied andset into which for list1 for list if list1 words in this line put the number of rows in List2 end< The top 10 values of span class= "Hljs-keyword" >endprint list2 while ( True) Enter a line of string s to define a flag array List3for list convert s to array a for a if a[" in list. Get () flag is true else flag for false endif flag is true Add the number of rows to List3 Span class= "Hljs-keyword" >endprint list3           

3.3 Experimental Summary

Instead of using a map, I use ArrayList to record it, so I'm going to go through an array of loops. :

4.Stream and Lambda

Write a student class that has the following properties:

private Long id;private String name;private int age;private Gender gender;//枚举类型private boolean joinsACM; //是否参加过ACM比赛

Creates a collection object, such as a list

4.1 Writing a search method using traditional methods list

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)

5. Generic type: Generalstack

The Generalstack of jmu-java-05-collection of title set

5.1 Code for Generalstack interface

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

Generics do not have a specified element type compared to the previous code, which allows us to manipulate multiple data types with one code, which reduces the amount of code and increases the code's reusability.

3. Code Cloud and PTA

Topic Set: jmu-java-05-Collection

3.1. Code Cloud codes Submission record
在码云的项目中,依次选择“统计-Commits历史-设置时间段”, 然后搜索并

3.2 PTA Problem set complete situation diagram


3.3 Count the amount of code completed this week

Week Time Total code Amount New Code Volume total number of files number of new files
2 625 625 99 99
3 1429 804 113 14
4 3354 1925 223 110
5 3751 397 241 18
6 4369 618 80 -161
7 4998 629 78 -2
8 5590 592 87 9
9 5751 161 89 2
4. Assess how much you understand Java

Dimension of Degree
Grammar Most of the problems of PTA can be easily handled
Object-oriented design capabilities Using object-oriented thinking to model the problem to be solved is not familiar, most of the code is not object-oriented thinking
Application capabilities Using Java to write some very simple gadgets is a good
Number of lines of code so far 5751

201621123030 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.