201621123006 Java Programming 9th Week of study summary

Source: Internet
Author: User

1. Summary of this week's study
1.1 Summarize the set and generic related content in the way you like (mind mapping or other).

2. Written work

Collection of this homework question set
Delete 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.

    • This topic requires the writing of two functions, convertStringToList(String line) using a String [] s = line.split(" "); statement to separate characters with a space, and then put into the dynamic array, add the words directly with the add() good. The remove(List<String> list, String str) function is to iterate through the list, call the equals() method to compare elements, the same element is remove() deleted.
    • Method of deleting elements in list: 1, using list.remove() method; 2, removing with iteratorsIterator a = List.iterator();

Count the number of words in the text and sort them by the number of occurrences (title of the topic)

2.1 pseudocode (Do not copy code, otherwise deduct)

    • New One TreeMap
    • String word=sc.next();Read in text
      if (Word.equals ("!!!!!"))
      Jump out of the loop;
    • Define a variable time=0,if (no key in Word), add a word and set its value to 1;
    • Else add a word whose value changes to time+1;
    • Creates a new ArrayList object that Collections.sort() is sorted and outputs the first 10 elements.

2.2 Experimental Summary
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

    • The question did not make a result ...

3.2 pseudocode (Do not copy code, otherwise deduct)

    • Creating TreeMap and ArrayList
    • Read in the word, if (Word is "!!!!!"), jump out of the loop
    • If (there is no key in Word), add the word and the number of lines in the map;
    • Else add only the number of rows
    • Enter keywords, traverse each row for comparison, and the same output.
      (Uh ... I don't know what I'm talking about ... This question really does not ... )

3.3 Experimental Summary

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;//enum type
Private Boolean JOINSACM; Have you participated in the ACM contest?

Creates a collection object, such as a list
4.1 Writing a search method using traditional methods list

Raw method test Data

 System.out.println("201621123006 安晏菊");            List<Students> student = new ArrayList<Students>();            student.add(new Students(1,"AN",18,Gender.woman,true));            student.add(new Students(2,"ZHANG",17,Gender.man,true));            student.add(new Students(3,"WANG",17,Gender.man,false));            student.add(new Students(4,"LI",15,Gender.man,true));            student.add(new Students(5,"ZHOU",19,Gender.woman,true));            student.add(new Students(6,"LIU",18,Gender.woman,false));            

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)

Generic class: 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?

    • Unsafe coercion of type conversions is no longer required.
    • We can use an interface to manipulate different types of stacks, and the code is more concise.

3. Code Cloud and PTA
Topic Set: jmu-java-05-Collection
3.1. Code Cloud codes Submission record

3.2 PTA Problem set complete situation diagram

3.3 Count the amount of code completed this week

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

Dimension of degree
Grammar PTA problem is still a little difficult to complete, most of the time need a roommate to help check the wrong changes to pass.
Object-oriented design capabilities There is not a very clear understanding of this piece, not very familiar.
Application capabilities The ability to apply is awkward ... Like before the big job is a team work, and I do is a relatively simple part.
Number of lines of code so far 2529

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