201621123080 Java Programming 9th Week of study summary

Source: Internet
Author: User
Tags int size

Job 09-Collection and generics 1. This week's 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 list (title of topic) 1.1 Experimental summary. and answer: list at least 2 kinds in ListThe method to delete the element in the

Experimental summary: This problem in the go space is split(" +") less + caused by a string containing more than a blank error read.
Method: First list.remove() Delete the specified element, list.clear() delete all elements

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)
建立一个key为单词value为出现次数的Map;将文本按空格分割并存入数组words,遇"!!!!!"停止;遍历words并存入Map;将数组排序按出现次数大小及字母用内部类比较器排序;输出数组前十个元素;
2.2 Experimental Summary

This problem just beginning to Entry understand not deep enough, behind Baidu see Java Map and Map.entry detailed understanding only understand. The problem is not perfect, in error, do not know what the reason.

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 pseudo-code (not copied code, otherwise deducted)
建立一个key为单词value为所出现行数的数组的Map;将每行的文本存入数组lineList以便后续读取;读取文本一行,按空格分割并存入数组words,遇"!!!!!"停止;遍历words,并将单词及其所在行数存入Map;输入需要查找的关键词;查找及比较其所在行是否存在相同部分;若存在则输出该行,反之输出无结果;
3.3 Experimental Summary

This problem is in the final part of the search, the current unexpected algorithm.

4. StreamAnd 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<Student> number Student of objects within it for subsequent tests.

4.1 Writing a search method using traditional methods List<Student> search(List<Student> stuList, Long id, String name, int age, Gender gender, boolean joinsACM), and then call the method to id> a value, name is a value, age> a value, gender to a value, students who have participated in the ACM contest are screened out and put into a new collection. Called in Main, and then outputs the result. (: The number of the school, name)

4.2 Using the JAVA8 in the stream(), filter(), collect () writes the code with the same 4.1 and tests (to show the test data). When building a test set, in addition to the normal StudentObject, and then add some to the collection null, the method you write should be able to handle these nullInstead 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
interface GeneralStack<E>{    E push(E item);            //如item为null,则不入栈直接返回null。    E pop();                 //出栈,如为栈为空,则返回null。    E peek();                //获得栈顶元素,如为空,则返回null.    public boolean empty();//如为空返回true    public int size();     //返回栈中元素数量}
5.2 Combining the subject with the previous work ArrayListIntegerStackWhat are the benefits of generics compared to

Multiple types can be implemented, no longer confined to a single type (for example Integer ), greatly reducing the amount of code and making it Stack more flexible and practical.
PTA on this topic is really puzzled some output to how to come.

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

Two graphs are required (1. Ranking chart. 2.PTA Submission list diagram)

3.3 Count the amount of code completed this week

The weekly code statistics need to be fused into a single table.
Can you achieve your goals?

Week Time Total code Amount New Code Volume total number of files number of new files
1 0 0 0 0
2 0 0 0 0
3 472 472 11 11
4 472 0 11 0
5 468 -4 12 1
6 1043 575 30 18
7 2417 1374 51 21st
8 5129 2712 83 32
9 5284 155 89 6
10 5714 430 98 9

4. Assess how much you understand Java

Try to evaluate how much you understand Java from the following dimensions

Dimension of degree
Grammar PTA part of the problem can be solved, there are grammatical problems
Object-oriented design capabilities Simple problem modeling only
Application capabilities Simple gadgets to achieve
Number of lines of code so far 5714 (less actual)

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