1. This week study summary 1.1 summarizes the set and generic related content in the way you like (mind map or other).
Generics personally think can be understood as a kind of fuzzy type, in which various methods are written, programmers can create specific types of objects as needed, and then call the generic method inside. This helps simplify the code.
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 ways to delete elements in the list.
The topic is relatively easy, as long as the requirements of the problem can be completed.
- Delete elements directly with
Lsit.removei
-
Create a new list , place the required elements in the new list , and clear the old list
2. Count the number of words in the text and sort them by the number of occurrences ( Title of the topic) 2.1 Pseudo-code (must not copy code, otherwise deducted) while (true) {/* * * the word ' (key) ' and occurrences ' (value) ' One by one corresponds to */}collections.sort () {/* * Comparison */}for () {/* * Output/}
2.2 Experiment Summary Main NOTE the new Word's value to be set to 1, already have the word in the original value< /code> value on +1. The final implementation is to implement sorting using the collections interface.
Key sections:
list<map.entry<string, integer>> infoids =new arraylist<map.entry<string, Integer> > (Map.entryset ()); Collections.sort (Infoids, New comparator<map.entry<string, integer>> () {public int compare (map.entry< ; String, integer> O1, map.entry<string, integer> O2) {if (O2.getvalue ()-O1.getvalue () ==0) Retu RN (O1.getkey ()). ToString (). CompareTo (O2.getkey ()); Return (O2.getvalue ()-o1.getvalue ()); }});
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)
创建map存储单词和所在行数 创建List对象listString,存储每一行的句子 创建List对象result存储索引结果 while(in.hasNext()){ 实现单词和所在行数的一一对应 } for{ 将map输出 } while(in.hasNext()){ 索引,将结果存入result,然后输出 }
3.3 Experimental Summary
The subject is more difficult and has been done for a long time. The first thing you should create Map<String,ArrayList<Integer>> map = new TreeMap<>(); is to store the word and the number of rows it contains. You should be aware of updates that store the number of rows at this time list . Index, separate the words of the string you are looking for, call the contains method, and if one row contains the word you want to index, add the number of rows result and finally output the result.
4.Stream and Lambda
编写一个Student类,属性为: 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
interface GeneralStack<E> { public E push(E item); public E pop(); public E peek(); public boolean empty(); public int size(); }
5.2 What are the benefits of generics compared to arraylistintegerstack in previous assignments?
ArrayListIntegerStackThere is only one data type, and the subject can implement a variety of data types of operations, through generics, we simply define a generic interface and implement it, we can achieve a variety of types of operations.
3. Code Cloud and PTA
Topic Set: jmu-java-05-Collection
3.1. Code Cloud codes Submission record
In the Code cloud Project, select statistics-commits history-set time period, and then search for and
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 |
160 |
160 |
49 |
49 |
| 2 |
387 |
227 |
55 |
6 |
| 3 |
630 |
243 |
59 |
4 |
| 4 |
968 |
238 |
65 |
5 |
| 5 |
1171 |
203 |
69 |
4 |
| 6 |
1626 |
445 |
77 |
8 |
| 7 |
2061 |
435 |
80 |
3 |
| 8 |
2385 |
324 |
86 |
6 |
| 9 |
2727 |
342 |
90 |
4 |
4. Assess how much you understand Java
| Dimension of |
degree |
| Grammar |
PTA problem is not much difficult to handle most |
| Object-oriented design capabilities |
I'm not familiar with it. |
| Application capabilities |
So so |
| Number of lines of code so far |
2727 |
201621123018 Java Programming 9th week of study report